赞 | 13 |
VIP | 9 |
好人卡 | 3 |
积分 | 51 |
经验 | 27577 |
最后登录 | 2024-10-30 |
在线时间 | 1004 小时 |
Lv4.逐梦者 【欧皇】
- 梦石
- 3
- 星屑
- 2066
- 在线时间
- 1004 小时
- 注册时间
- 2013-8-19
- 帖子
- 3486
|
本帖最后由 欧买歌 于 2014-4-9 21:06 编辑
这个要改game.ini,另外,除了那个分辨率的,下面可加不可加随你,这是我做的的游戏里的。[Game]- [Game]
- Library=RGSS103J.dll
- Scripts=Data\Scripts.rxdata
- Title=游戏名
- RTP1=
- RTP2=
- RTP3=
- [Window]
- ; 窗口客户区分辨率宽;字符串长度不要超过 15
- width=1024
- ; 窗口客户区分辨率高;字符串长度不要超过 15
- height=704
- ;下面的可加不可加
- ;=================================================
- ;=================================================
- ;=================================================
- ; 以下属性,0 表示“否”,1表示“是”。
- ;=================================================
- ; 窗口是否为 Pop-up 窗口
- popup=1
- ; 窗口是否有一个细线边框;如果 popup 未启用则无效
- border=1
- ; 窗口是否有一个标题栏;如果 popup 未启用则无效;如果启用则同时启用 border
- caption=1
- ; 窗口是否启用最小化按钮
- minimizebox=1
- ; 窗口是否启用最大化按钮
- maximizebox=0
- ; 窗口是否拥有可自由拖拽改变窗口尺寸的厚边框
- thickframe=0
- ; 窗口的标题栏是否有一个系统菜单
- sysmenu=1
- ; 窗口客户区是否拥有边框
- clientedge=0
- ; 窗口是否有双层边框
- dlgmodalframe=0
- ; 窗口是否有 3D 窗口边框
- staticedge=0
- ; 窗口是否有突起的边框
- windowedge=0
- [Font]
- ; 需要加载的私有字体资源文件名,必须是 ASCII 字符(所以不能是中文);
- ; 如需加载多于一个的字体,则用 `|' 竖线分隔(ASCII 字符),不要插入空格;
- ; 整体字符串长度(等号后)不得超过 255;超出限制的字体名所保存的资源无法加载
- names=ygyjfcs2.ttf|fanzhuanshu.ttf
复制代码 用了这个分辨率后,菜单的位置肯定就不对,所以要加这个脚本:- # ————————————————————————————————————
- # 本脚本来自www.66rpg.com,转载请保留此信息
- # ————————————————————————————————————
-
- class Win32API
- GAME_INI_FILE = ".\\Game.ini"
- HWND_TOPMOST = 0
- HWND_TOP = -1
- SWP_NOMOVE = 0
- SWP_FRAMECHANGED = 0
- HWND_NOTTOPMOST = 0
- WM_GETMINMAXINFO = 24
- end
- $width = 1024
- $height = 800
- #==============================================================================
- # ■ Spriteset_Map
- #------------------------------------------------------------------------------
- # 处理地图画面活动块和元件的类。本类在 Scene_Map 类的内部使用。
- #==============================================================================
- class Spriteset_Map
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- @viewport2 = Viewport.new(0, 0, $width, $height) #——生成图片
- @viewport3 = Viewport.new(0, 0, $width, $height) #——生成画面闪烁用的部分
- $viewport4 = Viewport.new(640, 0, $width-640, 480) #——右侧
- $viewport5 = Viewport.new(0, 480, 640, $height-480) #——下侧
- $viewport6 = Viewport.new(640, 480, $width-640, $height-480) #——右下角
- $viewport1 = Viewport.new(0, 0, 1024, 704) #——主窗口
- @viewport_weather = Viewport.new(0, 0, $width, $height) #——生成天气专用
- @viewport2.z = 200 #——生成图片的深度
- @viewport3.z = 5000 #——生成画面闪烁用的深度
- @tilemap = Tilemap.new($viewport1) #——主窗口
- @tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
- @tilemap2 = Tilemap.new($viewport4) #——右侧
- @tilemap2.tileset = RPG::Cache.tileset($game_map.tileset_name)
- @tilemap3 = Tilemap.new($viewport5) #——下侧
- @tilemap3.tileset = RPG::Cache.tileset($game_map.tileset_name)
- @tilemap4 = Tilemap.new($viewport6) #——右下角
- @tilemap4.tileset = RPG::Cache.tileset($game_map.tileset_name)
- for i in 0..6 #——生成自动元件
- autotile_name = $game_map.autotile_names[i]
- @tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
- @tilemap2.autotiles[i] = RPG::Cache.autotile(autotile_name)
- @tilemap3.autotiles[i] = RPG::Cache.autotile(autotile_name)
- @tilemap4.autotiles[i] = RPG::Cache.autotile(autotile_name)
- end
- @tilemap.map_data = $game_map.data #——生成地图数据
- @tilemap2.map_data = $game_map.data
- @tilemap3.map_data = $game_map.data
- @tilemap4.map_data = $game_map.data
- @tilemap.priorities = $game_map.priorities #——生成优先
- @tilemap2.priorities = $game_map.priorities
- @tilemap3.priorities = $game_map.priorities
- @tilemap4.priorities = $game_map.priorities
- @character_sprites = [] #——生成事件
- for i in $game_map.events.keys.sort
- sprite = Sprite_Character.new($viewport1, $game_map.events[i])
- @character_sprites.push(sprite)
- sprite = Sprite_Character.new($viewport4, $game_map.events[i])
- @character_sprites.push(sprite)
- sprite = Sprite_Character.new($viewport5, $game_map.events[i])
- @character_sprites.push(sprite)
- sprite = Sprite_Character.new($viewport6, $game_map.events[i])
- @character_sprites.push(sprite)
- end #——下面继续生成角色
- @character_sprites.push(Sprite_Character.new($viewport1, $game_player))
- @character_sprites.push(Sprite_Character.new($viewport4, $game_player))
- @character_sprites.push(Sprite_Character.new($viewport5, $game_player))
- @character_sprites.push(Sprite_Character.new($viewport6, $game_player))
- #——下面生成远景
- @panorama = Plane.new($viewport1)
- @panorama.z = -1000
- @panorama2 = Plane.new($viewport4)
- @panorama2.z = -1000
- @panorama3 = Plane.new($viewport5)
- @panorama3.z = -1000
- @panorama4 = Plane.new($viewport6)
- @panorama4.z = -1000
- #——下面生成雾
- [url=home.php?mod=space&uid=14217]@fog[/url] = Plane.new($viewport1)
- @fog.z = 3000
- @fog2 = Plane.new($viewport4)
- @fog2.z = 3000
- @fog3 = Plane.new($viewport5)
- @fog3.z = 3000
- @fog4 = Plane.new($viewport6)
- @fog4.z = 3000
- #——下面生成天气
- @weather = Weather.new(@viewport_weather)
- @picture_sprites = [] #——这里生成图片
- for i in 1..50
- @picture_sprites.push(Sprite_Picture.new(@viewport2, $game_screen.pictures[i]))
- end
- @timer_sprite = Sprite_Timer.new #——生成计时器
- #——刷新
- update
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- @tilemap.tileset.dispose #——释放元件地图
- @tilemap2.tileset.dispose
- @tilemap3.tileset.dispose
- @tilemap4.tileset.dispose
- for i in 0..6
- @tilemap.autotiles[i].dispose
- @tilemap2.autotiles[i].dispose
- @tilemap3.autotiles[i].dispose
- @tilemap4.autotiles[i].dispose
- end
- @tilemap.dispose
- @tilemap2.dispose
- @tilemap3.dispose
- @tilemap4.dispose
- @panorama.dispose #——释放远景平面
- @panorama2.dispose
- @panorama3.dispose
- @panorama4.dispose
- @fog.dispose #——释放雾平面
- @fog2.dispose
- @fog3.dispose
- @fog4.dispose
- for sprite in @character_sprites #——释放角色活动块
- sprite.dispose
- end
- @weather.dispose
- for sprite in @picture_sprites
- sprite.dispose
- end
- # 释放计时器块
- @timer_sprite.dispose
- # 释放显示端口
- $viewport1.dispose
- @viewport2.dispose
- @viewport3.dispose
- $viewport4.dispose
- $viewport5.dispose
- $viewport6.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 远景与现在的情况有差异发情况下
- if @panorama_name != $game_map.panorama_name or @panorama_hue != $game_map.panorama_hue
- @panorama_name = $game_map.panorama_name
- @panorama_hue = $game_map.panorama_hue
- if @panorama.bitmap != nil
- @panorama.bitmap.dispose
- @panorama.bitmap = nil
- @panorama2.bitmap.dispose
- @panorama2.bitmap = nil
- @panorama3.bitmap.dispose
- @panorama3.bitmap = nil
- @panorama4.bitmap.dispose
- @panorama4.bitmap = nil
- end
- if @panorama_name != ""
- @panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
- @panorama2.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
- @panorama3.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
- @panorama4.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
- end
- Graphics.frame_reset
- end
- # 雾与现在的情况有差异的情况下
- if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
- @fog_name = $game_map.fog_name
- @fog_hue = $game_map.fog_hue
- if @fog.bitmap != nil
- @fog.bitmap.dispose
- @fog.bitmap = nil
- @fog2.bitmap.dispose
- @fog2.bitmap = nil
- @fog3.bitmap.dispose
- @fog3.bitmap = nil
- @fog4.bitmap.dispose
- @fog4.bitmap = nil
- end
- if @fog_name != ""
- @fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
- @fog2.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
- @fog3.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
- @fog4.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
- end
- Graphics.frame_reset
- end
- # 刷新元件地图
- @tilemap.ox = $game_map.display_x / 4
- @tilemap.oy = $game_map.display_y / 4
- @tilemap.update
- @tilemap2.ox = @tilemap.ox
- @tilemap2.oy = @tilemap.oy
- @tilemap2.update
- @tilemap3.ox = @tilemap.ox
- @tilemap3.oy = @tilemap.oy + 480
- @tilemap3.update
- @tilemap4.ox = @tilemap.ox
- @tilemap4.oy = @tilemap.oy + 480
- @tilemap4.update
- # 刷新远景平面
- @panorama.ox = $game_map.display_x / 8
- @panorama.oy = $game_map.display_y / 8
- @panorama2.ox = @panorama.ox
- @panorama2.oy = @panorama.oy
- @panorama3.ox = @panorama.ox
- @panorama3.oy = @panorama.oy + 480
- @panorama4.ox = @panorama.ox
- @panorama4.oy = @panorama.oy + 480
- # 刷新雾平面
- @[email protected][email protected][email protected]_x = $game_map.fog_zoom / 100.0
- @[email protected][email protected][email protected]_y = $game_map.fog_zoom / 100.0
- @[email protected][email protected][email protected] = $game_map.fog_opacity
- @[email protected][email protected][email protected]_type = $game_map.fog_blend_type
- @fog4.tone = @fog3.tone = @fog2.tone = @fog.tone = $game_map.fog_tone
- @fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
- @fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
- @fog2.ox = @fog.ox #+ 140#*@fog.zoom_x
- @fog2.oy = @fog.oy
- @fog3.ox = @fog.ox
- @fog3.oy = @fog.oy + 480
- @fog4.ox = @fog.ox
- @fog4.oy = @fog.oy + 480
- # 刷新角色活动块
- for sprite in @character_sprites
- sprite.update
- end
- # 刷新天候图形
- @weather.type = $game_screen.weather_type
- @weather.max = $game_screen.weather_max
- @weather.ox = $game_map.display_x / 4
- @weather.oy = $game_map.display_y / 4
- @weather.update
- # 刷新图片
- for sprite in @picture_sprites
- sprite.update
- end
- # 刷新计时器块
- @timer_sprite.update
- # 设置画面的色调与震动位置
- $viewport1.tone = $game_screen.tone
- $viewport1.ox = $game_screen.shake
- $viewport4.tone = $game_screen.tone
- $viewport4.ox = $game_screen.shake+640
- $viewport5.tone = $game_screen.tone
- $viewport5.ox = $game_screen.shake
- $viewport6.tone = $game_screen.tone
- $viewport6.ox = $game_screen.shake+640
- # 设置画面的闪烁色
- @viewport3.color = $game_screen.flash_color
- # 刷新显示端口
- $viewport1.update
- @viewport3.update
- $viewport4.update
- $viewport5.update
- $viewport6.update
- end
- end
- class Weather
- def initialize(viewport = nil)
- @type = 0
- @max = 0
- @ox = 0
- @oy = 0
- color1 = Color.new(255, 255, 255, 255)
- color2 = Color.new(255, 255, 255, 128)
- @rain_bitmap = Bitmap.new(7, 56)
- for i in 0..6
- @rain_bitmap.fill_rect(6-i, i*8, 1, 8, color1)
- end
- @storm_bitmap = Bitmap.new(34, 64)
- for i in 0..31
- @storm_bitmap.fill_rect(33-i, i*2, 1, 2, color2)
- @storm_bitmap.fill_rect(32-i, i*2, 1, 2, color1)
- @storm_bitmap.fill_rect(31-i, i*2, 1, 2, color2)
- end
- @snow_bitmap = Bitmap.new(6, 6)
- @snow_bitmap.fill_rect(0, 1, 6, 4, color2)
- @snow_bitmap.fill_rect(1, 0, 4, 6, color2)
- @snow_bitmap.fill_rect(1, 2, 4, 2, color1)
- @snow_bitmap.fill_rect(2, 1, 2, 4, color1)
- @sprites = []
- for i in 1..40
- sprite = Sprite.new(viewport)
- sprite.z = 1000
- sprite.visible = false
- sprite.opacity = 0
- @sprites.push(sprite)
- end
- end
- def dispose
- for sprite in @sprites
- sprite.dispose
- end
- @rain_bitmap.dispose
- @storm_bitmap.dispose
- @snow_bitmap.dispose
- end
- def type=(type)
- return if @type == type
- @type = type
- case @type
- when 1
- bitmap = @rain_bitmap
- when 2
- bitmap = @storm_bitmap
- when 3
- bitmap = @snow_bitmap
- else
- bitmap = nil
- end
- for i in 1..40
- sprite = @sprites[i]
- if sprite != nil
- sprite.visible = (i <= @max)
- sprite.bitmap = bitmap
- end
- end
- end
- def ox=(ox)
- return if @ox == ox;
- @ox = ox
- for sprite in @sprites
- sprite.ox = @ox
- end
- end
- def oy=(oy)
- return if @oy == oy;
- @oy = oy
- for sprite in @sprites
- sprite.oy = @oy
- end
- end
- def max=(max)
- return if @max == max;
- @max = [[max, 0].max, 40].min
- for i in 1..40
- sprite = @sprites[i]
- if sprite != nil
- sprite.visible = (i <= @max)
- end
- end
- end
- def update
- return if @type == 0
- for i in 1..@max
- sprite = @sprites[i]
- if sprite == nil
- break
- end
- if @type == 1
- sprite.x -= 2
- sprite.y += 16
- sprite.opacity -= 8
- end
- if @type == 2
- sprite.x -= 8
- sprite.y += 16
- sprite.opacity -= 12
- end
- if @type == 3
- sprite.x -= 2
- sprite.y += 8
- sprite.opacity -= 8
- end
- x = sprite.x - @ox
- y = sprite.y - @oy
- if sprite.opacity < 64 or x < -50 or x > $width+150 or y < -300 or y > $height+100
- sprite.x = rand($width+150) - 50 + @ox
- sprite.y = rand($height+100) - 200 + @oy
- sprite.opacity = 255
- end
- end
- end
- attr_reader :type
- attr_reader :max
- attr_reader :ox
- attr_reader :oy
- end
- #==============================================================================
- # ■ Game_Player
- #------------------------------------------------------------------------------
- # 处理主角的类。事件启动的判定、以及地图的滚动等功能。
- # 本类的实例请参考 $game_player。
- #==============================================================================
-
- class Game_Player < Game_Character
- #--------------------------------------------------------------------------
- # ● 恒量
- #--------------------------------------------------------------------------
- CENTER_X = ($width/2 - 16) * 4
- CENTER_Y = ($height/2 - 16) * 4
- #--------------------------------------------------------------------------
- # ● 可以通行判定
- # x : X 坐标
- # y : Y 坐标
- # d : 方向 (0,2,4,6,8) ※ 0 = 全方向不能通行的情况判定 (跳跃用)
- #--------------------------------------------------------------------------
- def passable?(x, y, d)
- # 求得新的坐标
- new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
- new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
- # 坐标在地图外的情况下
- unless $game_map.valid?(new_x, new_y)
- # 不能通行
- return false
- end
- # 调试模式为 ON 并且 按下 CTRL 键的情况下
- if $DEBUG and Input.press?(Input::CTRL)
- # 可以通行
- return true
- end
- super
- end
- #--------------------------------------------------------------------------
- # ● 像通到画面中央一样的设置地图的显示位置
- #--------------------------------------------------------------------------
- def center(x, y)
- max_x = ($game_map.width - 20) * 128
- max_y = ($game_map.height - 15) * 128
- $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max
- $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max
- $game_map.scroll_down(0)
- $game_map.scroll_right(0)
- end
- #--------------------------------------------------------------------------
- # ● 向指定的位置移动
- # x : X 座標
- # y : Y 座標
- #--------------------------------------------------------------------------
- def moveto(x, y)
- super
- # 自连接
- center(x, y)
- # 生成遇敌计数
- make_encounter_count
- end
- #--------------------------------------------------------------------------
- # ● 增加步数
- #--------------------------------------------------------------------------
- def increase_steps
- super
- # 不是强制移动路线的场合
- unless @move_route_forcing
- # 增加步数
- $game_party.increase_steps
- # 步数是偶数的情况下
- if $game_party.steps % 2 == 0
- # 检查连续伤害
- $game_party.check_map_slip_damage
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 获取遇敌计数
- #--------------------------------------------------------------------------
- def encounter_count
- return @encounter_count
- end
- #--------------------------------------------------------------------------
- # ● 生成遇敌计数
- #--------------------------------------------------------------------------
- def make_encounter_count
- # 两种颜色震动的图像
- if $game_map.map_id != 0
- n = $game_map.encounter_step
- @encounter_count = rand(n) + rand(n) + 1
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- # 同伴人数为 0 的情况下
- if $game_party.actors.size == 0
- # 清除角色的文件名及对像
- @character_name = ""
- @character_hue = 0
- # 分支结束
- return
- end
- # 获取带头的角色
- actor = $game_party.actors[0]
- # 设置角色的文件名及对像
- @character_name = actor.character_name
- @character_hue = actor.character_hue
- # 初始化不透明度和合成方式子
- @opacity = 255
- @blend_type = 0
- end
- #--------------------------------------------------------------------------
- # ● 同位置的事件启动判定
- #--------------------------------------------------------------------------
- def check_event_trigger_here(triggers)
- result = false
- # 事件执行中的情况下
- if $game_system.map_interpreter.running?
- return result
- end
- # 全部事件的循环
- for event in $game_map.events.values
- # 事件坐标与目标一致的情况下
- if event.x == @x and event.y == @y and triggers.include?(event.trigger)
- # 跳跃中以外的情况下、启动判定是同位置的事件
- if not event.jumping? and event.over_trigger?
- event.start
- result = true
- end
- end
- end
- return result
- end
- #--------------------------------------------------------------------------
- # ● 正面事件的启动判定
- #--------------------------------------------------------------------------
- def check_event_trigger_there(triggers)
- result = false
- # 事件执行中的情况下
- if $game_system.map_interpreter.running?
- return result
- end
- # 计算正面坐标
- new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
- new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
- # 全部事件的循环
- for event in $game_map.events.values
- # 事件坐标与目标一致的情况下
- if event.x == new_x and event.y == new_y and
- triggers.include?(event.trigger)
- # 跳跃中以外的情况下、启动判定是正面的事件
- if not event.jumping? and not event.over_trigger?
- event.start
- result = true
- end
- end
- end
- # 找不到符合条件的事件的情况下
- if result == false
- # 正面的元件是计数器的情况下
- if $game_map.counter?(new_x, new_y)
- # 计算 1 元件里侧的坐标
- new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
- new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
- # 全事件的循环
- for event in $game_map.events.values
- # 事件坐标与目标一致的情况下
- if event.x == new_x and event.y == new_y and
- triggers.include?(event.trigger)
- # 跳跃中以外的情况下、启动判定是正面的事件
- if not event.jumping? and not event.over_trigger?
- event.start
- result = true
- end
- end
- end
- end
- end
- return result
- end
- #--------------------------------------------------------------------------
- # ● 接触事件启动判定
- #--------------------------------------------------------------------------
- def check_event_trigger_touch(x, y)
- result = false
- # 事件执行中的情况下
- if $game_system.map_interpreter.running?
- return result
- end
- # 全事件的循环
- for event in $game_map.events.values
- # 事件坐标与目标一致的情况下
- if event.x == x and event.y == y and [1,2].include?(event.trigger)
- # 跳跃中以外的情况下、启动判定是正面的事件
- if not event.jumping? and not event.over_trigger?
- event.start
- result = true
- end
- end
- end
- return result
- end
- #--------------------------------------------------------------------------
- # ● 画面更新
- #--------------------------------------------------------------------------
- def update
- # 本地变量记录移动信息
- last_moving = moving?
- # 移动中、事件执行中、强制移动路线中、
- # 信息窗口一个也不显示的时候
- unless moving? or $game_system.map_interpreter.running? or
- @move_route_forcing or $game_temp.message_window_showing
- # 如果方向键被按下、主角就朝那个方向移动
- case Input.dir4
- when 2
- move_down
- when 4
- move_left
- when 6
- move_right
- when 8
- move_up
- end
- end
- # 本地变量记忆坐标
- last_real_x = @real_x
- last_real_y = @real_y
- super
- # 角色向下移动、画面上的位置在中央下方的情况下
- if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
- # 画面向下卷动
- $game_map.scroll_down(@real_y - last_real_y)
- end
- # 角色向左移动、画面上的位置在中央左方的情况下
- if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
- # 画面向左卷动
- $game_map.scroll_left(last_real_x - @real_x)
- end
- # 角色向右移动、画面上的位置在中央右方的情况下
- if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
- # 画面向右卷动
- $game_map.scroll_right(@real_x - last_real_x)
- end
- # 角色向上移动、画面上的位置在中央上方的情况下
- if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
- # 画面向上卷动
- $game_map.scroll_up(last_real_y - @real_y)
- end
- # 不在移动中的情况下
- unless moving?
- # 上次主角移动中的情况
- if last_moving
- # 与同位置的事件接触就判定为事件启动
- result = check_event_trigger_here([1,2])
- # 没有可以启动的事件的情况下
- if result == false
- # 调试模式为 ON 并且按下 CTRL 键的情况下除外
- unless $DEBUG and Input.press?(Input::CTRL)
- # 遇敌计数下降
- if @encounter_count > 0
- @encounter_count -= 1
- end
- end
- end
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 判定为同位置以及正面的事件启动
- check_event_trigger_here([0])
- check_event_trigger_there([0,1,2])
- end
- end
- end
- end
- #==============================================================================
- # ■ Scene_Gameover
- #------------------------------------------------------------------------------
- # 处理游戏结束画面的类。
- #==============================================================================
-
- class Scene_Gameover
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 生成游戏结束图形
- if $game_temp.in_battle
- @temp_sprite = Spriteset_Battle.new
- else
- @temp_sprite = Spriteset_Map.new
- end
- @sprite = Sprite.new
- @sprite.bitmap = RPG::Cache.gameover($data_system.gameover_name)
- @sprite.opacity = 0
- # 停止 BGM、BGS
- $game_system.bgm_play(nil)
- $game_system.bgs_play(nil)
- # 演奏游戏结束 ME
- $game_system.me_play($data_system.gameover_me)
- # 执行过渡
- Graphics.transition(0)
- # 主循环
- for i in 0..120
- @sprite.opacity +=4
- Graphics.update
- end
- @temp_sprite.dispose
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面情报
- update
- # 如果画面被切换的话就中断循环
- if $scene != self
- break
- end
- end
- # 释放游戏结束图形
- @sprite.bitmap.dispose
- @sprite.dispose
- # 执行过度
- Graphics.transition(0)
- # 准备过渡
- if $BTEST
- $scene = nil
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- for i in 0..30
- @sprite.opacity -=10
- Graphics.update
- end
- # 切换到标题画面
- $scene = Scene_Title.new
- end
- end
- end
- #==============================================================================
- # ■ Scene_Title
- #------------------------------------------------------------------------------
- # 处理标题画面的类。
- #==============================================================================
-
- class Scene_Title
- #--------------------------------------------------------------------------
- # ● 住处理
- #--------------------------------------------------------------------------
- def main
- # 战斗测试的情况下
- if $BTEST
- battle_test
- return
- end
- # 载入数据库
- $data_actors = load_data("Data/Actors.rxdata")
- $data_classes = load_data("Data/Classes.rxdata")
- $data_skills = load_data("Data/Skills.rxdata")
- $data_items = load_data("Data/Items.rxdata")
- $data_weapons = load_data("Data/Weapons.rxdata")
- $data_armors = load_data("Data/Armors.rxdata")
- $data_enemies = load_data("Data/Enemies.rxdata")
- $data_troops = load_data("Data/Troops.rxdata")
- $data_states = load_data("Data/States.rxdata")
- $data_animations = load_data("Data/Animations.rxdata")
- $data_tilesets = load_data("Data/Tilesets.rxdata")
- $data_common_events = load_data("Data/CommonEvents.rxdata")
- $data_system = load_data("Data/System.rxdata")
- # 生成系统对像
- $game_system = Game_System.new
- # 生成标题图形
- @sprite = Sprite.new
- @sprite.bitmap = RPG::Cache.title($data_system.title_name)
- @sprite.opacity = 0
- # 生成命令窗口
- s1 = "新游戏"
- s2 = "继续"
- s3 = "退出"
- @command_window = Window_Command.new(192, [s1, s2, s3])
- @command_window.back_opacity = 160
- @command_window.x = $width /2 - @command_window.width / 2
- @command_window.y = $height /2 +132
- # 判定继续的有效性
- # 存档文件一个也不存在的时候也调查
- # 有効为 @continue_enabled 为 true、無効为 false
- @continue_enabled = false
- for i in 0..3
- if FileTest.exist?("Save#{i+1}.rxdata")
- @continue_enabled = true
- end
- end
- # 继续为有效的情况下、光标停止在继续上
- # 无效的情况下、继续的文字显示为灰色
- if @continue_enabled
- @command_window.index = 1
- else
- @command_window.disable_item(1)
- end
- # 演奏标题 BGM
- $game_system.bgm_play($data_system.title_bgm)
- # 停止演奏 ME、BGS
- Audio.me_stop
- Audio.bgs_stop
- # 执行过渡
- Graphics.transition(0)
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面被切换就中断循环
- if $scene != self
- break
- end
- end
- # 装备过渡
- Graphics.freeze
- # 释放命令窗口
- @command_window.dispose
- # 释放标题图形
- @sprite.bitmap.dispose
- @sprite.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- if @sprite.opacity < 255
- @sprite.opacity += 15
- end
- # 刷新命令窗口
- @command_window.update
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 命令窗口的光标位置的分支
- case @command_window.index
- when 0 # 新游戏
- command_new_game
- when 1 # 继续
- command_continue
- when 2 # 退出
- command_shutdown
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 命令 : 新游戏
- #--------------------------------------------------------------------------
- def command_new_game
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 停止 BGM
- Audio.bgm_stop
- # 重置测量游戏时间用的画面计数器
- Graphics.frame_count = 0
- # 生成各种游戏对像
- $game_temp = Game_Temp.new
- $game_system = Game_System.new
- $game_switches = Game_Switches.new
- $game_variables = Game_Variables.new
- $game_self_switches = Game_SelfSwitches.new
- $game_screen = Game_Screen.new
- $game_actors = Game_Actors.new
- $game_party = Game_Party.new
- $game_troop = Game_Troop.new
- $game_map = Game_Map.new
- $game_player = Game_Player.new
- # 设置初期同伴位置
- $game_party.setup_starting_members
- # 设置初期位置的地图
- $game_map.setup($data_system.start_map_id)
- # 主角向初期位置移动
- $game_player.moveto($data_system.start_x, $data_system.start_y)
- # 刷新主角
- $game_player.refresh
- # 执行地图设置的 BGM 与 BGS 的自动切换
- $game_map.autoplay
- # 刷新地图 (执行并行事件)
- $game_map.update
- # 切换地图画面
- $scene = Scene_Map.new
- end
- #--------------------------------------------------------------------------
- # ● 命令 : 继续
- #--------------------------------------------------------------------------
- def command_continue
- # 继续无效的情况下
- unless @continue_enabled
- # 演奏无效 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到读档画面
- $scene = Scene_Load.new
- end
- #--------------------------------------------------------------------------
- # ● 命令 : 退出
- #--------------------------------------------------------------------------
- def command_shutdown
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # BGM、BGS、ME 的淡入淡出
- Audio.bgm_fade(800)
- Audio.bgs_fade(800)
- Audio.me_fade(800)
- # 退出
- tempBitmap = Sprite.new
- tempBitmap.bitmap = Bitmap.new($width,$height)
- tempBitmap.bitmap.fill_rect(0, 0, $width, $height, Color.new(0,0,0,255))
- tempBitmap.opacity = 0
- for i in 0..20
- tempBitmap.opacity+=14
- Graphics.update
- end
- $scene = nil
- end
- #--------------------------------------------------------------------------
- # ● 战斗测试
- #--------------------------------------------------------------------------
- def battle_test
- # 载入数据库 (战斗测试用)
- $data_actors = load_data("Data/BT_Actors.rxdata")
- $data_classes = load_data("Data/BT_Classes.rxdata")
- $data_skills = load_data("Data/BT_Skills.rxdata")
- $data_items = load_data("Data/BT_Items.rxdata")
- $data_weapons = load_data("Data/BT_Weapons.rxdata")
- $data_armors = load_data("Data/BT_Armors.rxdata")
- $data_enemies = load_data("Data/BT_Enemies.rxdata")
- $data_troops = load_data("Data/BT_Troops.rxdata")
- $data_states = load_data("Data/BT_States.rxdata")
- $data_animations = load_data("Data/BT_Animations.rxdata")
- $data_tilesets = load_data("Data/BT_Tilesets.rxdata")
- $data_common_events = load_data("Data/BT_CommonEvents.rxdata")
- $data_system = load_data("Data/BT_System.rxdata")
- # 重置测量游戏时间用的画面计数器
- Graphics.frame_count = 0
- # 生成各种游戏对像
- $game_temp = Game_Temp.new
- $game_system = Game_System.new
- $game_switches = Game_Switches.new
- $game_variables = Game_Variables.new
- $game_self_switches = Game_SelfSwitches.new
- $game_screen = Game_Screen.new
- $game_actors = Game_Actors.new
- $game_party = Game_Party.new
- $game_troop = Game_Troop.new
- $game_map = Game_Map.new
- $game_player = Game_Player.new
- # 设置战斗测试用同伴
- $game_party.setup_battle_test_members
- # 设置队伍 ID、可以逃走标志、战斗背景
- $game_temp.battle_troop_id = $data_system.test_troop_id
- $game_temp.battle_can_escape = true
- $game_map.battleback_name = $data_system.battleback_name
- # 演奏战斗开始 BGM
- $game_system.se_play($data_system.battle_start_se)
- # 演奏战斗 BGM
- $game_system.bgm_play($game_system.battle_bgm)
- # 切换到战斗画面
- $scene = Scene_Battle.new
- end
- end
- #==============================================================================
- # ■ Scene_Map
- #------------------------------------------------------------------------------
- # 处理地图画面的类。
- #==============================================================================
-
- class Scene_Map
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 生成活动块
- @spriteset = Spriteset_Map.new
- # 生成信息窗口
- @message_window = Window_Message.new
- tempBitmap = Sprite.new
- tempBitmap.bitmap = Bitmap.new($width,$height)
- tempBitmap.bitmap.fill_rect(0, 0, $width, $height, Color.new(0,0,0,255))
- # 执行过渡
- Graphics.transition(0)
- for i in 0..10
- tempBitmap.opacity-=25
- Graphics.update
- end
- tempBitmap.bitmap.dispose
- tempBitmap.dispose
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面切换的话就中断循环
- if $scene != self
- break
- end
- end
- # 标题画面切换中的情况下
- if $scene.is_a?(Scene_Title)
- @message_window.dispose
- tempBitmap = Sprite.new
- tempBitmap.bitmap = Bitmap.new($width,$height)
- tempBitmap.bitmap.fill_rect(0, 0, $width, $height, Color.new(0,0,0,255))
- tempBitmap.opacity = 0
- for i in 0..25
- tempBitmap.opacity +=11
- Graphics.update
- end
- tempBitmap.bitmap.dispose
- tempBitmap.dispose
- Graphics.transition(0)
- @spriteset.dispose
- else
- @message_window.dispose
- @spriteset.dispose
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 循环
- loop do
- # 按照地图、实例、主角的顺序刷新
- # (本更新顺序不会在的满足事件的执行条件下成为给予角色瞬间移动
- # 的机会的重要因素)
- $game_map.update
- $game_system.map_interpreter.update
- $game_player.update
- # 系统 (计时器)、画面刷新
- $game_system.update
- $game_screen.update
- # 如果主角在场所移动中就中断循环
- unless $game_temp.player_transferring
- break
- end
- # 执行场所移动
- transfer_player
- # 处理过渡中的情况下、中断循环
- if $game_temp.transition_processing
- break
- end
- end
- # 刷新活动块
- @spriteset.update
- # 刷新信息窗口
- @message_window.update
- # 游戏结束的情况下
- if $game_temp.gameover
- # 切换的游戏结束画面
- $scene = Scene_Gameover.new
- return
- end
- # 返回标题画面的情况下
- if $game_temp.to_title
- # 切换到标题画面
- $scene = Scene_Title.new
- return
- end
- # 处理过渡中的情况下
- if $game_temp.transition_processing
- # 清除过渡处理中标志
- $game_temp.transition_processing = false
- # 执行过渡
- Graphics.transition(0)
- end
- # 显示信息窗口中的情况下
- if $game_temp.message_window_showing
- return
- end
- # 遇敌计数为 0 且、且遇敌列表不为空的情况下
- if $game_player.encounter_count == 0 and $game_map.encounter_list != []
- # 不是在事件执行中或者禁止遇敌中
- unless $game_system.map_interpreter.running? or
- $game_system.encounter_disabled
- # 确定队伍
- n = rand($game_map.encounter_list.size)
- troop_id = $game_map.encounter_list[n]
- # 队伍有效的话
- if $data_troops[troop_id] != nil
- # 设置调用战斗标志
- $game_temp.battle_calling = true
- $game_temp.battle_troop_id = troop_id
- $game_temp.battle_can_escape = true
- $game_temp.battle_can_lose = false
- $game_temp.battle_proc = nil
- end
- end
- end
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 不是在事件执行中或菜单禁止中
- unless $game_system.map_interpreter.running? or
- $game_system.menu_disabled
- # 设置菜单调用标志以及 SE 演奏
- $game_temp.menu_calling = true
- $game_temp.menu_beep = true
- end
- end
- # 调试模式为 ON 并且按下 F9 键的情况下
- if $DEBUG and Input.press?(Input::F9)
- # 设置调用调试标志
- $game_temp.debug_calling = true
- end
- # 不在主角移动中的情况下
- unless $game_player.moving?
- # 执行各种画面的调用
- if $game_temp.battle_calling
- call_battle
- elsif $game_temp.shop_calling
- call_shop
- elsif $game_temp.name_calling
- call_name
- elsif $game_temp.menu_calling
- call_menu
- elsif $game_temp.save_calling
- call_save
- elsif $game_temp.debug_calling
- call_debug
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 调用战斗
- #--------------------------------------------------------------------------
- def call_battle
- # 清除战斗调用标志
- $game_temp.battle_calling = false
- # 清除菜单调用标志
- $game_temp.menu_calling = false
- $game_temp.menu_beep = false
- # 生成遇敌计数
- $game_player.make_encounter_count
- # 记忆地图 BGM 、停止 BGM
- $game_temp.map_bgm = $game_system.playing_bgm
- $game_system.bgm_stop
- # 演奏战斗开始 SE
- $game_system.se_play($data_system.battle_start_se)
- # 演奏战斗 BGM
- $game_system.bgm_play($game_system.battle_bgm)
- # 矫正主角姿势
- $game_player.straighten
- # 切换到战斗画面
- $scene = Scene_Battle.new
- end
- #--------------------------------------------------------------------------
- # ● 调用商店
- #--------------------------------------------------------------------------
- def call_shop
- # 清除商店调用标志
- $game_temp.shop_calling = false
- # 矫正主角姿势
- $game_player.straighten
- # 切换到商店画面
- $scene = Scene_Shop.new
- end
- #--------------------------------------------------------------------------
- # ● 调用名称输入
- #--------------------------------------------------------------------------
- def call_name
- # 清除商店调用名称输入标志
- $game_temp.name_calling = false
- # 矫正主角姿势
- $game_player.straighten
- # 切换到名称输入画面
- $scene = Scene_Name.new
- end
- #--------------------------------------------------------------------------
- # ● 调用菜单
- #--------------------------------------------------------------------------
- def call_menu
- # 清除商店调用菜单标志
- $game_temp.menu_calling = false
- # 已经设置了菜单 SE 演奏标志的情况下
- if $game_temp.menu_beep
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 清除菜单演奏 SE 标志
- $game_temp.menu_beep = false
- end
- # 矫正主角姿势
- $game_player.straighten
- # 切换到菜单画面
- $scene = Scene_Menu.new
- end
- #--------------------------------------------------------------------------
- # ● 调用存档
- #--------------------------------------------------------------------------
- def call_save
- # 矫正主角姿势
- $game_player.straighten
- # 切换到存档画面
- $scene = Scene_Save.new
- end
- #--------------------------------------------------------------------------
- # ● 调用调试
- #--------------------------------------------------------------------------
- def call_debug
- # 清除商店调用调试标志
- $game_temp.debug_calling = false
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 矫正主角姿势
- $game_player.straighten
- # 切换到调试画面
- $scene = Scene_Debug.new
- end
- #--------------------------------------------------------------------------
- # ● 主角的场所移动
- #--------------------------------------------------------------------------
- def transfer_player
- # 清除主角场所移动调试标志
- $game_temp.player_transferring = false
- # 移动目标与现在的地图有差异的情况下
- if $game_map.map_id != $game_temp.player_new_map_id
- # 设置新地图
- $game_map.setup($game_temp.player_new_map_id)
- end
- # 设置主角位置
- $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
- # 设置主角朝向
- case $game_temp.player_new_direction
- when 2 # 下
- $game_player.turn_down
- when 4 # 左
- $game_player.turn_left
- when 6 # 右
- $game_player.turn_right
- when 8 # 上
- $game_player.turn_up
- end
- # 矫正主角姿势
- $game_player.straighten
- # 刷新地图 (执行并行事件)
- $game_map.update
- # 在生成活动块
- @spriteset.dispose
- @spriteset = Spriteset_Map.new
- # 处理过渡中的情况下
- if $game_temp.transition_processing
- # 清除过渡处理中标志
- $game_temp.transition_processing = false
- # 执行过渡
- $_t_Bitmap=Sprite.new
- $_t_Bitmap.bitmap = Bitmap.new($width,$height)
- $_t_Bitmap.bitmap.fill_rect(0,0,$width,$height,Color.new(0,0,0,255))
- Graphics.transition(0)
- for i in 0..10
- $_t_Bitmap.opacity-=26
- Graphics.update
- end
- $_t_Bitmap.bitmap.dispose
- $_t_Bitmap.dispose
- end
- # 执行地图设置的 BGM、BGS 的自动切换
- $game_map.autoplay
- # 设置画面
- Graphics.frame_reset
- # 刷新输入信息
- Input.update
- end
- end
- #==============================================================================
- # ■ Interpreter (分割定义 5)
- #------------------------------------------------------------------------------
- # 执行事件命令的注释器。本类在 Game_System 类
- # 和 Game_Event 类的内部使用。
- #==============================================================================
-
- class Interpreter
- #--------------------------------------------------------------------------
- # ● 场所移动
- #--------------------------------------------------------------------------
- def command_201
- # 战斗中的情况
- if $game_temp.in_battle
- # 继续
- return true
- end
- # 场所移动中、信息显示中、过渡处理中的情况下
- if $game_temp.player_transferring or
- $game_temp.message_window_showing or
- $game_temp.transition_processing
- # 结束
- return false
- end
- # 设置场所移动标志
- $game_temp.player_transferring = true
- # 指定方法为 [直接指定] 的情况下
- if @parameters[0] == 0
- # 设置主角的移动目标
- $game_temp.player_new_map_id = @parameters[1]
- $game_temp.player_new_x = @parameters[2]
- $game_temp.player_new_y = @parameters[3]
- $game_temp.player_new_direction = @parameters[4]
- # 指定方法为 [使用变量指定] 的情况下
- else
- # 设置主角的移动目标
- $game_temp.player_new_map_id = $game_variables[@parameters[1]]
- $game_temp.player_new_x = $game_variables[@parameters[2]]
- $game_temp.player_new_y = $game_variables[@parameters[3]]
- $game_temp.player_new_direction = @parameters[4]
- end
- # 推进索引
- @index += 1
- # 有淡入淡出的情况下
- if @parameters[5] == 0
- # 准备过渡
- tempBitmap = Sprite.new
- tempBitmap.bitmap = Bitmap.new($width,$height)
- tempBitmap.bitmap.fill_rect(0, 0, $width, $height, Color.new(0,0,0,255))
- tempBitmap.opacity = 0
- for i in 0..10
- tempBitmap.opacity+=26
- Graphics.update
- end
- Graphics.freeze
- tempBitmap.bitmap.dispose
- tempBitmap.dispose
- # 设置过渡处理中标志
- $game_temp.transition_processing = true
- $game_temp.transition_name = ""
- end
- # 结束
- return false
- end
- #--------------------------------------------------------------------------
- # ● 设置事件位置
- #--------------------------------------------------------------------------
- def command_202
- # 战斗中的情况下
- if $game_temp.in_battle
- # 继续
- return true
- end
- # 获取角色
- character = get_character(@parameters[0])
- # 角色不存在的情况下
- if character == nil
- # 继续
- return true
- end
- # 指定方法为 [直接指定] 的情况下
- if @parameters[1] == 0
- # 设置角色的位置
- character.moveto(@parameters[2], @parameters[3])
- # 指定方法为 [使用变量指定] 的情况下
- elsif @parameters[1] == 1
- # 设置角色的位置
- character.moveto($game_variables[@parameters[2]],
- $game_variables[@parameters[3]])
- # 指定方法为 [与其它事件交换] 的情况下
- else
- old_x = character.x
- old_y = character.y
- character2 = get_character(@parameters[2])
- if character2 != nil
- character.moveto(character2.x, character2.y)
- character2.moveto(old_x, old_y)
- end
- end
- # 设置觉得的朝向
- case @parameters[4]
- when 8 # 上
- character.turn_up
- when 6 # 右
- character.turn_right
- when 2 # 下
- character.turn_down
- when 4 # 左
- character.turn_left
- end
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 地图的滚动
- #--------------------------------------------------------------------------
- def command_203
- # 战斗中的情况下
- if $game_temp.in_battle
- # 继续
- return true
- end
- # 已经在滚动中的情况下
- if $game_map.scrolling?
- # 结束
- return false
- end
- # 开始滚动
- $game_map.start_scroll(@parameters[0], @parameters[1], @parameters[2])
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 更改地图设置
- #--------------------------------------------------------------------------
- def command_204
- case @parameters[0]
- when 0 # 远景
- $game_map.panorama_name = @parameters[1]
- $game_map.panorama_hue = @parameters[2]
- when 1 # 雾
- $game_map.fog_name = @parameters[1]
- $game_map.fog_hue = @parameters[2]
- $game_map.fog_opacity = @parameters[3]
- $game_map.fog_blend_type = @parameters[4]
- $game_map.fog_zoom = @parameters[5]
- $game_map.fog_sx = @parameters[6]
- $game_map.fog_sy = @parameters[7]
- when 2 # 战斗背景
- $game_map.battleback_name = @parameters[1]
- $game_temp.battleback_name = @parameters[1]
- end
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 更改雾的色调
- #--------------------------------------------------------------------------
- def command_205
- # 开始更改色调
- $game_map.start_fog_tone_change(@parameters[0], @parameters[1] * 2)
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 更改雾的不透明度
- #--------------------------------------------------------------------------
- def command_206
- # 开始更改不透明度
- $game_map.start_fog_opacity_change(@parameters[0], @parameters[1] * 2)
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 显示动画
- #--------------------------------------------------------------------------
- def command_207
- # 获取角色
- character = get_character(@parameters[0])
- # 角色不存在的情况下
- if character == nil
- # 继续
- return true
- end
- # 设置动画 ID
- character.animation_id = @parameters[1]
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 更改透明状态
- #--------------------------------------------------------------------------
- def command_208
- # 设置主角的透明状态
- $game_player.transparent = (@parameters[0] == 0)
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 设置移动路线
- #--------------------------------------------------------------------------
- def command_209
- # 获取角色
- character = get_character(@parameters[0])
- # 角色不存在的情况下
- if character == nil
- # 继续
- return true
- end
- # 强制移动路线
- character.force_move_route(@parameters[1])
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 移动结束后等待
- #--------------------------------------------------------------------------
- def command_210
- # 如果不在战斗中
- unless $game_temp.in_battle
- # 设置移动结束后待机标志
- @move_route_waiting = true
- end
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 开始过渡
- #--------------------------------------------------------------------------
- def command_221
- # 显示信息窗口中的情况下
- if $game_temp.message_window_showing
- # 结束
- return false
- end
- # 准备过渡
- Graphics.freeze
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 执行过渡
- #--------------------------------------------------------------------------
- def command_222
- # 已经设置了过渡处理中标志的情况下
- if $game_temp.transition_processing
- # 结束
- return false
- end
- # 设置过渡处理中标志
- $game_temp.transition_processing = true
- $game_temp.transition_name = @parameters[0]
- # 推进索引
- @index += 1
- # 结束
- return false
- end
- #--------------------------------------------------------------------------
- # ● 更改画面色调
- #--------------------------------------------------------------------------
- def command_223
- # 开始更改色调
- $game_screen.start_tone_change(@parameters[0], @parameters[1] * 2)
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 画面闪烁
- #--------------------------------------------------------------------------
- def command_224
- # 开始闪烁
- $game_screen.start_flash(@parameters[0], @parameters[1] * 2)
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 画面震动
- #--------------------------------------------------------------------------
- def command_225
- # 震动开始
- $game_screen.start_shake(@parameters[0], @parameters[1],
- @parameters[2] * 2)
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 显示图片
- #--------------------------------------------------------------------------
- def command_231
- # 获取图片编号
- number = @parameters[0] + ($game_temp.in_battle ? 50 : 0)
- # 指定方法为 [直接指定] 的情况下
- if @parameters[3] == 0
- x = @parameters[4]
- y = @parameters[5]
- # 指定方法为 [使用变量指定] 的情况下
- else
- x = $game_variables[@parameters[4]]
- y = $game_variables[@parameters[5]]
- end
- # 显示图片
- $game_screen.pictures[number].show(@parameters[1], @parameters[2],
- x, y, @parameters[6], @parameters[7], @parameters[8], @parameters[9])
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 移动图片
- #--------------------------------------------------------------------------
- def command_232
- # 获取图片编号
- number = @parameters[0] + ($game_temp.in_battle ? 50 : 0)
- # 指定方法为 [直接指定] 的情况下
- if @parameters[3] == 0
- x = @parameters[4]
- y = @parameters[5]
- # 指定方法为 [使用变量指定] 的情况下
- else
- x = $game_variables[@parameters[4]]
- y = $game_variables[@parameters[5]]
- end
- # 移动图片
- $game_screen.pictures[number].move(@parameters[1] * 2, @parameters[2],
- x, y, @parameters[6], @parameters[7], @parameters[8], @parameters[9])
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 旋转图片
- #--------------------------------------------------------------------------
- def command_233
- # 获取图片编号
- number = @parameters[0] + ($game_temp.in_battle ? 50 : 0)
- # 设置旋转速度
- $game_screen.pictures[number].rotate(@parameters[1])
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 更改图片色调
- #--------------------------------------------------------------------------
- def command_234
- # 获取图片编号
- number = @parameters[0] + ($game_temp.in_battle ? 50 : 0)
- # 开始更改色调
- $game_screen.pictures[number].start_tone_change(@parameters[1],
- @parameters[2] * 2)
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 删除图片
- #--------------------------------------------------------------------------
- def command_235
- # 获取图片编号
- number = @parameters[0] + ($game_temp.in_battle ? 50 : 0)
- # 删除图片
- $game_screen.pictures[number].erase
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 天候设置
- #--------------------------------------------------------------------------
- def command_236
- # 设置天候
- $game_screen.weather(@parameters[0], @parameters[1], @parameters[2])
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 演奏 BGM
- #--------------------------------------------------------------------------
- def command_241
- # 演奏 BGM
- $game_system.bgm_play(@parameters[0])
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● BGM 的淡入淡出
- #--------------------------------------------------------------------------
- def command_242
- # 淡入淡出 BGM
- $game_system.bgm_fade(@parameters[0])
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 演奏 BGS
- #--------------------------------------------------------------------------
- def command_245
- # 演奏 BGS
- $game_system.bgs_play(@parameters[0])
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● BGS 的淡入淡出
- #--------------------------------------------------------------------------
- def command_246
- # 淡入淡出 BGS
- $game_system.bgs_fade(@parameters[0])
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 记忆 BGM / BGS
- #--------------------------------------------------------------------------
- def command_247
- # 记忆 BGM / BGS
- $game_system.bgm_memorize
- $game_system.bgs_memorize
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 还原 BGM / BGS
- #--------------------------------------------------------------------------
- def command_248
- # 还原 BGM / BGS
- $game_system.bgm_restore
- $game_system.bgs_restore
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 演奏 ME
- #--------------------------------------------------------------------------
- def command_249
- # 演奏 ME
- $game_system.me_play(@parameters[0])
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 演奏 SE
- #--------------------------------------------------------------------------
- def command_250
- # 演奏 SE
- $game_system.se_play(@parameters[0])
- # 继续
- return true
- end
- #--------------------------------------------------------------------------
- # ● 停止 SE
- #--------------------------------------------------------------------------
- def command_251
- # 停止 SE
- Audio.se_stop
- # 继续
- return true
- end
- end
- #==============================================================================
- # ■ Game_Enemy
- #------------------------------------------------------------------------------
- # 处理敌人的类。本类在 Game_Troop 类 ($game_troop) 的
- # 内部使用。
- #==============================================================================
-
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # troop_id : 循环 ID
- # member_index : 循环成员的索引
- #--------------------------------------------------------------------------
- def initialize(troop_id, member_index)
- super()
- @troop_id = troop_id
- @member_index = member_index
- troop = $data_troops[@troop_id]
- @enemy_id = troop.members[@member_index].enemy_id
- enemy = $data_enemies[@enemy_id]
- @battler_name = enemy.battler_name
- @battler_hue = enemy.battler_hue
- @hp = maxhp
- @sp = maxsp
- @hidden = troop.members[@member_index].hidden
- @immortal = troop.members[@member_index].immortal
- end
- #--------------------------------------------------------------------------
- # ● 获取敌人 ID
- #--------------------------------------------------------------------------
- def id
- return @enemy_id
- end
- #--------------------------------------------------------------------------
- # ● 获取索引
- #--------------------------------------------------------------------------
- def index
- return @member_index
- end
- #--------------------------------------------------------------------------
- # ● 获取名称
- #--------------------------------------------------------------------------
- def name
- return $data_enemies[@enemy_id].name
- end
- #--------------------------------------------------------------------------
- # ● 获取基本 MaxHP
- #--------------------------------------------------------------------------
- def base_maxhp
- return $data_enemies[@enemy_id].maxhp
- end
- #--------------------------------------------------------------------------
- # ● 获取基本 MaxSP
- #--------------------------------------------------------------------------
- def base_maxsp
- return $data_enemies[@enemy_id].maxsp
- end
- #--------------------------------------------------------------------------
- # ● 获取基本力量
- #--------------------------------------------------------------------------
- def base_str
- return $data_enemies[@enemy_id].str
- end
- #--------------------------------------------------------------------------
- # ● 获取基本灵巧
- #--------------------------------------------------------------------------
- def base_dex
- return $data_enemies[@enemy_id].dex
- end
- #--------------------------------------------------------------------------
- # ● 获取基本速度
- #--------------------------------------------------------------------------
- def base_agi
- return $data_enemies[@enemy_id].agi
- end
- #--------------------------------------------------------------------------
- # ● 获取基本魔力
- #--------------------------------------------------------------------------
- def base_int
- return $data_enemies[@enemy_id].int
- end
- #--------------------------------------------------------------------------
- # ● 获取基本攻击力
- #--------------------------------------------------------------------------
- def base_atk
- return $data_enemies[@enemy_id].atk
- end
- #--------------------------------------------------------------------------
- # ● 获取基本物理防御
- #--------------------------------------------------------------------------
- def base_pdef
- return $data_enemies[@enemy_id].pdef
- end
- #--------------------------------------------------------------------------
- # ● 获取基本魔法防御
- #--------------------------------------------------------------------------
- def base_mdef
- return $data_enemies[@enemy_id].mdef
- end
- #--------------------------------------------------------------------------
- # ● 获取基本回避修正
- #--------------------------------------------------------------------------
- def base_eva
- return $data_enemies[@enemy_id].eva
- end
- #--------------------------------------------------------------------------
- # ● 普通攻击 获取攻击方动画 ID
- #--------------------------------------------------------------------------
- def animation1_id
- return $data_enemies[@enemy_id].animation1_id
- end
- #--------------------------------------------------------------------------
- # ● 普通攻击 获取对像方动画 ID
- #--------------------------------------------------------------------------
- def animation2_id
- return $data_enemies[@enemy_id].animation2_id
- end
- #--------------------------------------------------------------------------
- # ● 获取属性修正值
- # element_id : 属性 ID
- #--------------------------------------------------------------------------
- def element_rate(element_id)
- # 获取对应属性有效度的数值
- table = [0,200,150,100,50,0,-100]
- result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
- # 状态能防御本属性的情况下效果减半
- for i in @states
- if $data_states[i].guard_element_set.include?(element_id)
- result /= 2
- end
- end
- # 过程结束
- return result
- end
- #--------------------------------------------------------------------------
- # ● 获取属性有效度
- #--------------------------------------------------------------------------
- def state_ranks
- return $data_enemies[@enemy_id].state_ranks
- end
- #--------------------------------------------------------------------------
- # ● 属性防御判定
- # state_id : 状态 ID
- #--------------------------------------------------------------------------
- def state_guard?(state_id)
- return false
- end
- #--------------------------------------------------------------------------
- # ● 获取普通攻击属性
- #--------------------------------------------------------------------------
- def element_set
- return []
- end
- #--------------------------------------------------------------------------
- # ● 获取普通攻击的状态变化 (+)
- #--------------------------------------------------------------------------
- def plus_state_set
- return []
- end
- #--------------------------------------------------------------------------
- # ● 获取普通攻击的状态变化 (-)
- #--------------------------------------------------------------------------
- def minus_state_set
- return []
- end
- #--------------------------------------------------------------------------
- # ● 获取行动
- #--------------------------------------------------------------------------
- def actions
- return $data_enemies[@enemy_id].actions
- end
- #--------------------------------------------------------------------------
- # ● 获取 EXP
- #--------------------------------------------------------------------------
- def exp
- return $data_enemies[@enemy_id].exp
- end
- #--------------------------------------------------------------------------
- # ● 获取金钱
- #--------------------------------------------------------------------------
- def gold
- return $data_enemies[@enemy_id].gold
- end
- #--------------------------------------------------------------------------
- # ● 获取物品 ID
- #--------------------------------------------------------------------------
- def item_id
- return $data_enemies[@enemy_id].item_id
- end
- #--------------------------------------------------------------------------
- # ● 获取武器 ID
- #--------------------------------------------------------------------------
- def weapon_id
- return $data_enemies[@enemy_id].weapon_id
- end
- #--------------------------------------------------------------------------
- # ● 获取放具 ID
- #--------------------------------------------------------------------------
- def armor_id
- return $data_enemies[@enemy_id].armor_id
- end
- #--------------------------------------------------------------------------
- # ● 获取宝物出现率
- #--------------------------------------------------------------------------
- def treasure_prob
- return $data_enemies[@enemy_id].treasure_prob
- end
- #--------------------------------------------------------------------------
- # ● 取得战斗画面 X 坐标
- #--------------------------------------------------------------------------
- def screen_x
- return $data_troops[@troop_id].members[@member_index].x*$width/640
- end
- #--------------------------------------------------------------------------
- # ● 取得战斗画面 Y 坐标
- #--------------------------------------------------------------------------
- def screen_y
- return $data_troops[@troop_id].members[@member_index].y*$height/480
- end
- #--------------------------------------------------------------------------
- # ● 取得战斗画面 Z 坐标
- #--------------------------------------------------------------------------
- def screen_z
- return screen_y
- end
- #--------------------------------------------------------------------------
- # ● 逃跑
- #--------------------------------------------------------------------------
- def escape
- # 设置击中标志
- @hidden = true
- # 清除当前行动
- self.current_action.clear
- end
- #--------------------------------------------------------------------------
- # ● 变身
- # enemy_id : 变身为的敌人 ID
- #--------------------------------------------------------------------------
- def transform(enemy_id)
- # 更改敌人 ID
- @enemy_id = enemy_id
- # 更改战斗图形
- @battler_name = $data_enemies[@enemy_id].battler_name
- @battler_hue = $data_enemies[@enemy_id].battler_hue
- # 在生成行动
- make_action
- end
- #--------------------------------------------------------------------------
- # ● 生成行动
- #--------------------------------------------------------------------------
- def make_action
- # 清除当前行动
- self.current_action.clear
- # 无法行动的情况
- unless self.movable?
- # 过程结束
- return
- end
- # 抽取现在有效的行动
- available_actions = []
- rating_max = 0
- for action in self.actions
- # 确认回合条件
- n = $game_temp.battle_turn
- a = action.condition_turn_a
- b = action.condition_turn_b
- if (b == 0 and n != a) or
- (b > 0 and (n < 1 or n < a or n % b != a % b))
- next
- end
- # 确认 HP 条件
- if self.hp * 100.0 / self.maxhp > action.condition_hp
- next
- end
- # 确认等级条件
- if $game_party.max_level < action.condition_level
- next
- end
- # 确认开关条件
- switch_id = action.condition_switch_id
- if switch_id > 0 and $game_switches[switch_id] == false
- next
- end
- # 符合条件 : 添加本行动
- available_actions.push(action)
- if action.rating > rating_max
- rating_max = action.rating
- end
- end
- # 最大概率值作为 3 合计计算(0 除外)
- ratings_total = 0
- for action in available_actions
- if action.rating > rating_max - 3
- ratings_total += action.rating - (rating_max - 3)
- end
- end
- # 概率合计不为 0 的情况下
- if ratings_total > 0
- # 生成随机数
- value = rand(ratings_total)
- # 设置对应生成随机数的当前行动
- for action in available_actions
- if action.rating > rating_max - 3
- if value < action.rating - (rating_max - 3)
- self.current_action.kind = action.kind
- self.current_action.basic = action.basic
- self.current_action.skill_id = action.skill_id
- self.current_action.decide_random_target_for_enemy
- return
- else
- value -= action.rating - (rating_max - 3)
- end
- end
- end
- end
- end
- end
- #==============================================================================
- # ■ Game_Map
- #------------------------------------------------------------------------------
- # 处理地图的类。包含卷动以及可以通行的判断功能。
- # 本类的实例请参考 $game_map 。
- #==============================================================================
-
- class Game_Map
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :tileset_name # 元件 文件名
- attr_accessor :autotile_names # 自动元件 文件名
- attr_accessor :panorama_name # 全景 文件名
- attr_accessor :panorama_hue # 全景 色相
- attr_accessor :fog_name # 雾 文件名
- attr_accessor :fog_hue # 雾 色相
- attr_accessor :fog_opacity # 雾 不透明度
- attr_accessor :fog_blend_type # 雾 混合方式
- attr_accessor :fog_zoom # 雾 放大率
- attr_accessor :fog_sx # 雾 SX
- attr_accessor :fog_sy # 雾 SY
- attr_accessor :battleback_name # 战斗背景 文件名
- attr_accessor :display_x # 显示 X 坐标 * 128
- attr_accessor :display_y # 显示 Y 坐标 * 128
- attr_accessor :need_refresh # 刷新要求标志
- attr_reader :passages # 通行表
- attr_reader :priorities # 优先表
- attr_reader :terrain_tags # 地形标记表
- attr_reader :events # 事件
- attr_reader :fog_ox # 雾 原点 X 坐标
- attr_reader :fog_oy # 雾 原点 Y 坐标
- attr_reader :fog_tone # 雾 色调
- #--------------------------------------------------------------------------
- # ● 初始化条件
- #--------------------------------------------------------------------------
- def initialize
- @map_id = 0
- @display_x = 0
- @display_y = 0
- end
- #--------------------------------------------------------------------------
- # ● 设置
- # map_id : 地图 ID
- #--------------------------------------------------------------------------
- def setup(map_id)
- # 地图 ID 记录到 @map_id
- @map_id = map_id
- # 地图文件装载后、设置到 @map
- @map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))
- # 定义实例变量设置地图元件信息
- tileset = $data_tilesets[@map.tileset_id]
- @tileset_name = tileset.tileset_name
- @autotile_names = tileset.autotile_names
- @panorama_name = tileset.panorama_name
- @panorama_hue = tileset.panorama_hue
- @fog_name = tileset.fog_name
- @fog_hue = tileset.fog_hue
- @fog_opacity = tileset.fog_opacity
- @fog_blend_type = tileset.fog_blend_type
- @fog_zoom = tileset.fog_zoom
- @fog_sx = tileset.fog_sx
- @fog_sy = tileset.fog_sy
- @battleback_name = tileset.battleback_name
- @passages = tileset.passages
- @priorities = tileset.priorities
- @terrain_tags = tileset.terrain_tags
- # 初始化显示坐标
- @display_x = 0
- @display_y = 0
- # 清除刷新要求标志
- @need_refresh = false
- # 设置地图事件数据
- @events = {}
- for i in @map.events.keys
- @events[i] = Game_Event.new(@map_id, @map.events[i])
- end
- # 设置公共事件数据
- @common_events = {}
- for i in 1...$data_common_events.size
- @common_events[i] = Game_CommonEvent.new(i)
- end
- # 初始化雾的各种信息
- @fog_ox = 0
- @fog_oy = 0
- @fog_tone = Tone.new(0, 0, 0, 0)
- @fog_tone_target = Tone.new(0, 0, 0, 0)
- @fog_tone_duration = 0
- @fog_opacity_duration = 0
- @fog_opacity_target = 0
- # 初始化滚动信息
- @scroll_direction = 2
- @scroll_rest = 0
- @scroll_speed = 4
- end
- #--------------------------------------------------------------------------
- # ● 获取地图 ID
- #--------------------------------------------------------------------------
- def map_id
- return @map_id
- end
- #--------------------------------------------------------------------------
- # ● 获取宽度
- #--------------------------------------------------------------------------
- def width
- return @map.width
- end
- #--------------------------------------------------------------------------
- # ● 获取高度
- #--------------------------------------------------------------------------
- def height
- return @map.height
- end
- #--------------------------------------------------------------------------
- # ● 获取遇敌列表
- #--------------------------------------------------------------------------
- def encounter_list
- return @map.encounter_list
- end
- #--------------------------------------------------------------------------
- # ● 获取遇敌步数
- #--------------------------------------------------------------------------
- def encounter_step
- return @map.encounter_step
- end
- #--------------------------------------------------------------------------
- # ● 获取地图数据
- #--------------------------------------------------------------------------
- def data
- return @map.data
- end
- #--------------------------------------------------------------------------
- # ● BGM / BGS 自动切换
- #--------------------------------------------------------------------------
- def autoplay
- if @map.autoplay_bgm
- $game_system.bgm_play(@map.bgm)
- end
- if @map.autoplay_bgs
- $game_system.bgs_play(@map.bgs)
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- # 地图 ID 有效
- if @map_id > 0
- # 刷新全部的地图事件
- for event in @events.values
- event.refresh
- end
- # 刷新全部的公共事件
- for common_event in @common_events.values
- common_event.refresh
- end
- end
- # 清除刷新要求标志
- @need_refresh = false
- end
- #--------------------------------------------------------------------------
- # ● 滚动
- # distance : 滚动距离
- #--------------------------------------------------------------------------
- def scroll_down(distance)
- @display_y = [@display_y + distance, (self.height - ($height / 32.0)) * 128].min
- end
- #--------------------------------------------------------------------------
- def scroll_left(distance)
- @display_x = [@display_x - distance, 0].max
- end
- #--------------------------------------------------------------------------
- def scroll_right(distance)
- @display_x = [@display_x + distance, (self.width - ($width / 32.0)) * 128].min
- end
- #--------------------------------------------------------------------------
- def scroll_up(distance)
- @display_y = [@display_y - distance, 0].max
- end
- #--------------------------------------------------------------------------
- # ● 有效坐标判定
- # x : X 坐标
- # y : Y 坐标
- #--------------------------------------------------------------------------
- def valid?(x, y)
- return (x >= 0 and x < width and y >= 0 and y < height)
- end
- #--------------------------------------------------------------------------
- # ● 可以通行判定
- # x : X 坐标
- # y : Y 坐标
- # d : 方向 (0,2,4,6,8,10)
- # ※ 0,10 = 全方向不能通行的情况的判定 (跳跃等)
- # self_event : 自己 (判定事件可以通行的情况下)
- #--------------------------------------------------------------------------
- def passable?(x, y, d, self_event = nil)
- # 被给予的坐标地图外的情况下
- unless valid?(x, y)
- # 不能通行
- return false
- end
- # 方向 (0,2,4,6,8,10) 与障碍物接触 (0,1,2,4,8,0) 后变换
- bit = (1 << (d / 2 - 1)) & 0x0f
- # 循环全部的事件
- for event in events.values
- # 自己以外的元件与坐标相同的情况
- if event.tile_id >= 0 and event != self_event and
- event.x == x and event.y == y and not event.through
- # 如果障碍物的接触被设置的情况下
- if @passages[event.tile_id] & bit != 0
- # 不能通行
- return false
- # 如果全方向的障碍物的接触被设置的情况下
- elsif @passages[event.tile_id] & 0x0f == 0x0f
- # 不能通行
- return false
- # 这以外的优先度为 0 的情况下
- elsif @priorities[event.tile_id] == 0
- # 可以通行
- return true
- end
- end
- end
- # 从层按从上到下的顺序调查循环
- for i in [2, 1, 0]
- # 取得元件 ID
- tile_id = data[x, y, i]
- # 取得元件 ID 失败
- if tile_id == nil
- # 不能通行
- return false
- # 如果障碍物的接触被设置的情况下
- elsif @passages[tile_id] & bit != 0
- # 不能通行
- return false
- # 如果全方向的障碍物的接触被设置的情况下
- elsif @passages[tile_id] & 0x0f == 0x0f
- # 不能通行
- return false
- # 这以外的优先度为 0 的情况下
- elsif @priorities[tile_id] == 0
- # 可以通行
- return true
- end
- end
- # 可以通行
- return true
- end
- #--------------------------------------------------------------------------
- # ● 茂密判定
- # x : X 坐标
- # y : Y 坐标
- #--------------------------------------------------------------------------
- def bush?(x, y)
- if @map_id != 0
- for i in [2, 1, 0]
- tile_id = data[x, y, i]
- if tile_id == nil
- return false
- elsif @passages[tile_id] & 0x40 == 0x40
- return true
- end
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 反击判定
- # x : X 坐标
- # y : Y 坐标
- #--------------------------------------------------------------------------
- def counter?(x, y)
- if @map_id != 0
- for i in [2, 1, 0]
- tile_id = data[x, y, i]
- if tile_id == nil
- return false
- elsif @passages[tile_id] & 0x80 == 0x80
- return true
- end
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 地获取地形标志
- # x : X 坐标
- # y : Y 坐标
- #--------------------------------------------------------------------------
- def terrain_tag(x, y)
- if @map_id != 0
- for i in [2, 1, 0]
- tile_id = data[x, y, i]
- if tile_id == nil
- return 0
- elsif @terrain_tags[tile_id] > 0
- return @terrain_tags[tile_id]
- end
- end
- end
- return 0
- end
- #--------------------------------------------------------------------------
- # ● 获取指定位置的事件 ID
- # x : X 坐标
- # y : Y 坐标
- #--------------------------------------------------------------------------
- def check_event(x, y)
- for event in $game_map.events.values
- if event.x == x and event.y == y
- return event.id
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 滚动开始
- # direction : 滚动方向
- # distance : 滚动距离
- # speed : 滚动速度
- #--------------------------------------------------------------------------
- def start_scroll(direction, distance, speed)
- @scroll_direction = direction
- @scroll_rest = distance * 128
- @scroll_speed = speed
- end
- #--------------------------------------------------------------------------
- # ● 滚动中判定
- #--------------------------------------------------------------------------
- def scrolling?
- return @scroll_rest > 0
- end
- #--------------------------------------------------------------------------
- # ● 开始变更雾的色调
- # tone : 色调
- # duration : 时间
- #--------------------------------------------------------------------------
- def start_fog_tone_change(tone, duration)
- @fog_tone_target = tone.clone
- @fog_tone_duration = duration
- if @fog_tone_duration == 0
- @fog_tone = @fog_tone_target.clone
- end
- end
- #--------------------------------------------------------------------------
- # ● 开始变更雾的不透明度
- # opacity : 不透明度
- # duration : 时间
- #--------------------------------------------------------------------------
- def start_fog_opacity_change(opacity, duration)
- @fog_opacity_target = opacity * 1.0
- @fog_opacity_duration = duration
- if @fog_opacity_duration == 0
- @fog_opacity = @fog_opacity_target
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 还原必要的地图
- if $game_map.need_refresh
- refresh
- end
- # 滚动中的情况下
- if @scroll_rest > 0
- # 滚动速度变化为地图坐标系的距离
- distance = 2 ** @scroll_speed
- # 执行滚动
- case @scroll_direction
- when 2 # 下
- scroll_down(distance)
- when 4 # 左
- scroll_left(distance)
- when 6 # 右
- scroll_right(distance)
- when 8 # 上
- scroll_up(distance)
- end
- # 滚动距离的减法运算
- @scroll_rest -= distance
- end
- # 更新地图事件
- for event in @events.values
- event.update
- end
- # 更新公共事件
- for common_event in @common_events.values
- common_event.update
- end
- # 处理雾的滚动
- @fog_ox -= @fog_sx / 8.0
- @fog_oy -= @fog_sy / 8.0
- # 处理雾的色调变更
- if @fog_tone_duration >= 1
- d = @fog_tone_duration
- target = @fog_tone_target
- @fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d
- @fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d
- @fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d
- @fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d
- @fog_tone_duration -= 1
- end
- # 处理雾的不透明度变更
- if @fog_opacity_duration >= 1
- d = @fog_opacity_duration
- @fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d
- @fog_opacity_duration -= 1
- end
- end
- end
- #==============================================================================
- # ■ Sprite_Character
- #------------------------------------------------------------------------------
- # 角色显示用脚本。监视 Game_Character 类的实例、
- # 自动变化脚本状态。
- #==============================================================================
-
- class Sprite_Character < RPG::Sprite
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :character # 角色
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # viewport : 查看端口
- # character : 角色 (Game_Character)
- #--------------------------------------------------------------------------
- def initialize(viewport, character = nil)
- super(viewport)
- @vp = viewport
- @character = character
- update
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- # 元件 ID、文件名、色相与现在的情况存在差异的情况下
- if @tile_id != @character.tile_id or
- @character_name != @character.character_name or
- @character_hue != @character.character_hue
- # 记忆元件 ID 与文件名、色相
- @tile_id = @character.tile_id
- @character_name = @character.character_name
- @character_hue = @character.character_hue
- # 元件 ID 为有效值的情况下
- if @tile_id >= 384
- self.bitmap = RPG::Cache.tile($game_map.tileset_name,
- @tile_id, @character.character_hue)
- self.src_rect.set(0, 0, 32, 32)
- self.ox = 16
- self.oy = 32
- # 元件 ID 为无效值的情况下
- else
- self.bitmap = RPG::Cache.character(@character.character_name,
- @character.character_hue)
- @cw = bitmap.width / 4
- @ch = bitmap.height / 4
- self.ox = @cw / 2
- self.oy = @ch
- end
- end
- # 设置可视状态
- self.visible = (not @character.transparent)
- # 图形是角色的情况下
- if @tile_id == 0
- # 设置传送目标的矩形
- sx = @character.pattern * @cw
- sy = (@character.direction - 2) / 2 * @ch
- self.src_rect.set(sx, sy, @cw, @ch)
- end
- # 设置脚本的坐标
- self.x = @character.screen_x
- #if @character == $game_player
- if @vp == $viewport5 or @vp == $viewport6
- self.y = @character.screen_y-480
- self.z = @character.screen_z(@ch)-480
- else
- self.y = @character.screen_y
- self.z = @character.screen_z(@ch)
- end
- #else
- #self.y = @character.screen_y
- #self.z = @character.screen_z(@ch)
- #end
- # 设置不透明度、合成方式、茂密
- self.opacity = @character.opacity
- self.blend_type = @character.blend_type
- self.bush_depth = @character.bush_depth
- # 动画
- if @character.animation_id != 0
- animation = $data_animations[@character.animation_id]
- animation(animation, true)
- @character.animation_id = 0
- end
- end
- end
-
- class Weather
- def initialize(viewport = nil)
- @type = 0
- @max = 0
- @ox = 0
- @oy = 0
- color1 = Color.new(255, 255, 255, 255)
- color2 = Color.new(255, 255, 255, 128)
- @rain_bitmap = Bitmap.new(7, 56)
- for i in 0..6
- @rain_bitmap.fill_rect(6-i, i*8, 1, 8, color1)
- end
- @storm_bitmap = Bitmap.new(34, 64)
- for i in 0..31
- @storm_bitmap.fill_rect(33-i, i*2, 1, 2, color2)
- @storm_bitmap.fill_rect(32-i, i*2, 1, 2, color1)
- @storm_bitmap.fill_rect(31-i, i*2, 1, 2, color2)
- end
- @snow_bitmap = Bitmap.new(6, 6)
- @snow_bitmap.fill_rect(0, 1, 6, 4, color2)
- @snow_bitmap.fill_rect(1, 0, 4, 6, color2)
- @snow_bitmap.fill_rect(1, 2, 4, 2, color1)
- @snow_bitmap.fill_rect(2, 1, 2, 4, color1)
- @sprites = []
- for i in 1..40
- sprite = Sprite.new(viewport)
- sprite.z = 1000
- sprite.visible = false
- sprite.opacity = 0
- @sprites.push(sprite)
- end
- end
- def dispose
- for sprite in @sprites
- sprite.dispose
- end
- @rain_bitmap.dispose
- @storm_bitmap.dispose
- @snow_bitmap.dispose
- end
- def type=(type)
- return if @type == type
- @type = type
- case @type
- when 1
- bitmap = @rain_bitmap
- when 2
- bitmap = @storm_bitmap
- when 3
- bitmap = @snow_bitmap
- else
- bitmap = nil
- end
- for i in 1..40
- sprite = @sprites[i]
- if sprite != nil
- sprite.visible = (i <= @max)
- sprite.bitmap = bitmap
- end
- end
- end
- def ox=(ox)
- return if @ox == ox;
- @ox = ox
- for sprite in @sprites
- sprite.ox = @ox
- end
- end
- def oy=(oy)
- return if @oy == oy;
- @oy = oy
- for sprite in @sprites
- sprite.oy = @oy
- end
- end
- def max=(max)
- return if @max == max;
- @max = [[max, 0].max, 40].min
- for i in 1..40
- sprite = @sprites[i]
- if sprite != nil
- sprite.visible = (i <= @max)
- end
- end
- end
- def update
- return if @type == 0
- for i in 1..@max
- sprite = @sprites[i]
- if sprite == nil
- break
- end
- if @type == 1
- sprite.x -= 2
- sprite.y += 16
- sprite.opacity -= 8
- end
- if @type == 2
- sprite.x -= 8
- sprite.y += 16
- sprite.opacity -= 12
- end
- if @type == 3
- sprite.x -= 2
- sprite.y += 8
- sprite.opacity -= 8
- end
- x = sprite.x - @ox
- y = sprite.y - @oy
- if sprite.opacity < 64 or x < -50 or x > $width+150 or y < -300 or y > $height+100
- sprite.x = rand($width+150) - 50 + @ox
- sprite.y = rand($height+100) - 200 + @oy
- sprite.opacity = 255
- end
- end
- end
- attr_reader :type
- attr_reader :max
- attr_reader :ox
- attr_reader :oy
- end
复制代码 记得把分类改成“已经解决”。 |
评分
-
查看全部评分
|