赞 | 0 |
VIP | 555 |
好人卡 | 4 |
积分 | 1 |
经验 | 4658 |
最后登录 | 2016-1-23 |
在线时间 | 287 小时 |
Lv1.梦旅人 奇情异士
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 287 小时
- 注册时间
- 2006-7-5
- 帖子
- 3457
|
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- class Scene_Save
- #--------------------------------------------------------------------------
- # ● 写入存档数据
- # file : 写入用文件对像 (已经打开)
- #--------------------------------------------------------------------------
- def write_save_data(file)
- # 生成描绘存档文件用的角色图形
- characters = []
- for i in 0...[$game_party.actors.size,4].min
- actor = $game_party.actors[i]
- characters.push([actor.character_name, actor.character_hue])
- end
- # 写入描绘存档文件用的角色数据
- Marshal.dump(characters, file)
- # 写入测量游戏时间用画面计数
- Marshal.dump(Graphics.frame_count, file)
- # 增加 1 次存档次数
- $game_system.save_count += 1
- # 保存魔法编号
- # (将编辑器保存的值以随机值替换)
- $game_system.magic_number = $data_system.magic_number
- # 写入各种游戏对像
- Marshal.dump($game_system, file)
- Marshal.dump($game_switches, file)
- Marshal.dump($game_variables, file)
- Marshal.dump($game_self_switches, file)
- Marshal.dump($game_screen, file)
- Marshal.dump($game_actors, file)
- Marshal.dump($game_party, file)
- Marshal.dump($game_troop, file)
- Marshal.dump($game_map, file)
- Marshal.dump($game_player, file)
- end
- end
- class Scene_Battle
- #--------------------------------------------------------------------------
- # ● 设置物品或特技对像方的战斗者
- # scope : 特技或者是物品的范围
- #--------------------------------------------------------------------------
- def set_target_battlers(scope)
- # 行动方的战斗者是敌人的情况下
- if @active_battler.is_a?(Game_Enemy)
- # 效果范围分支
- case scope
- when 1 # 敌单体
- index = @active_battler.current_action.target_index
- @target_battlers.push($game_party.smooth_target_actor(index))
- when 2 # 敌全体
- for actor in 0...[$game_party.actors.size,4].min
- if $game_party.actors[actor].exist?
- @target_battlers.push($game_party.actors[actor])
- end
- end
- when 3 # 我方单体
- index = @active_battler.current_action.target_index
- @target_battlers.push($game_troop.smooth_target_enemy(index))
- when 4 # 我方全体
- for enemy in $game_troop.enemies
- if enemy.exist?
- @target_battlers.push(enemy)
- end
- end
- when 5 # 我方单体 (HP 0)
- index = @active_battler.current_action.target_index
- enemy = $game_troop.enemies[index]
- if enemy != nil and enemy.hp0?
- @target_battlers.push(enemy)
- end
- when 6 # 我方全体 (HP 0)
- for enemy in $game_troop.enemies
- if enemy != nil and enemy.hp0?
- @target_battlers.push(enemy)
- end
- end
- when 7 # 使用者
- @target_battlers.push(@active_battler)
- end
- end
- # 行动方的战斗者是角色的情况下
- if @active_battler.is_a?(Game_Actor)
- # 效果范围分支
- case scope
- when 1 # 敌单体
- index = @active_battler.current_action.target_index
- @target_battlers.push($game_troop.smooth_target_enemy(index))
- when 2 # 敌全体
- for enemy in $game_troop.enemies
- if enemy.exist?
- @target_battlers.push(enemy)
- end
- end
- when 3 # 我方单体
- index = @active_battler.current_action.target_index
- @target_battlers.push($game_party.smooth_target_actor(index))
- when 4 # 我方全体
- for actor in 0...[$game_party.actors.size,4].min
- if $game_party.actors[actor].exist?
- @target_battlers.push($game_party.actors[actor])
- end
- end
- when 5 # 我方单体 (HP 0)
- index = @active_battler.current_action.target_index
- actor = $game_party.actors[index]
- if actor != nil and actor.hp0?
- @target_battlers.push(actor)
- end
- when 6 # 我方全体 (HP 0)
- for actor in 0...[$game_party.actors.size,4].min
- if $game_party.actors[actor] != nil and $game_party.actors[actor].hp0?
- @target_battlers.push($game_party.actors[actor])
- end
- end
- when 7 # 使用者
- @target_battlers.push(@active_battler)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 生成行动循序
- #--------------------------------------------------------------------------
- def make_action_orders
- # 初始化序列 @action_battlers
- @action_battlers = []
- # 添加敌人到 @action_battlers 序列
- for enemy in $game_troop.enemies
- @action_battlers.push(enemy)
- end
- # 添加角色到 @action_battlers 序列
- for actor in 0...[$game_party.actors.size,4].min
- @action_battlers.push($game_party.actors[actor])
- end
- # 确定全体的行动速度
- for battler in @action_battlers
- battler.make_action_speed
- end
- # 按照行动速度从大到小排列
- @action_battlers.sort! {|a,b|
- b.current_action.speed - a.current_action.speed }
- end
- #--------------------------------------------------------------------------
- # ● 开始结束战斗回合
- #--------------------------------------------------------------------------
- def start_phase5
- # 转移到回合 5
- @phase = 5
- # 演奏战斗结束 ME
- $game_system.me_play($game_system.battle_end_me)
- # 还原为战斗开始前的 BGM
- $game_system.bgm_play($game_temp.map_bgm)
- # 初始化 EXP、金钱、宝物
- exp = 0
- gold = 0
- treasures = []
- # 循环
- for enemy in $game_troop.enemies
- # 敌人不是隐藏状态的情况下
- unless enemy.hidden
- # 获得 EXP、增加金钱
- exp += enemy.exp
- gold += enemy.gold
- # 出现宝物判定
- if rand(100) < enemy.treasure_prob
- if enemy.item_id > 0
- treasures.push($data_items[enemy.item_id])
- end
- if enemy.weapon_id > 0
- treasures.push($data_weapons[enemy.weapon_id])
- end
- if enemy.armor_id > 0
- treasures.push($data_armors[enemy.armor_id])
- end
- end
- end
- end
- # 限制宝物数为 6 个
- treasures = treasures[0..5]
- # 获得 EXP
- for i in 0...[$game_party.actors.size,4].min
- actor = $game_party.actors[i]
- if actor.cant_get_exp? == false
- last_level = actor.level
- actor.exp += exp
- if actor.level > last_level
- @status_window.level_up(i)
- end
- end
- end
- # 获得金钱
- $game_party.gain_gold(gold)
- # 获得宝物
- for item in treasures
- case item
- when RPG::Item
- $game_party.gain_item(item.id, 1)
- when RPG::Weapon
- $game_party.gain_weapon(item.id, 1)
- when RPG::Armor
- $game_party.gain_armor(item.id, 1)
- end
- end
- # 生成战斗结果窗口
- @result_window = Window_BattleResult.new(exp, gold, treasures)
- # 设置等待计数
- @phase5_wait_count = 100
- end
- #--------------------------------------------------------------------------
- # ● 转到输入下一个角色的命令
- #--------------------------------------------------------------------------
- def phase3_next_actor
- # 循环
- begin
- # 角色的明灭效果 OFF
- if @active_battler != nil
- @active_battler.blink = false
- end
- # 最后的角色的情况
- if @actor_index == [$game_party.actors.size-1,3].min
- # 开始主回合
- start_phase4
- return
- end
- # 推进角色索引
- @actor_index += 1
- @active_battler = $game_party.actors[@actor_index]
- @active_battler.blink = true
- # 如果角色是在无法接受指令的状态就再试
- end until @active_battler.inputable?
- # 设置角色的命令窗口
- phase3_setup_command_window
- end
- end
- class Arrow_Actor < Arrow_Base
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- super
- # 光标右
- if Input.repeat?(Input::RIGHT)
- $game_system.se_play($data_system.cursor_se)
- @index += 1
- @index %= [$game_party.actors.size,4].min
- end
- # 光标左
- if Input.repeat?(Input::LEFT)
- $game_system.se_play($data_system.cursor_se)
- @index += $game_party.actors.size - 1
- @index %= [$game_party.actors.size,4].min
- end
- # 设置活动块坐标
- if self.actor != nil
- self.x = self.actor.screen_x
- self.y = self.actor.screen_y
- end
- end
- end
- #==============================================================================
- # ■ Window_Target
- #------------------------------------------------------------------------------
- # 物品画面与特技画面的、使用对像角色选择窗口。
- #==============================================================================
- class Window_Target < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 336, 480)
- self.contents = Bitmap.new(width - 32, $game_party.actors.size*112)
- self.z += 10
- @item_max = $game_party.actors.size
- @top_row = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...$game_party.actors.size
- x = 4
- y = i * 112
- actor = $game_party.actors[i]
- draw_actor_name(actor, x, y)
- draw_actor_class(actor, x + 144, y)
- draw_actor_level(actor, x + 8, y + 32)
- draw_actor_state(actor, x + 8, y + 64)
- draw_actor_hp(actor, x + 152, y + 32)
- draw_actor_sp(actor, x + 152, y + 64)
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新光标矩形
- #--------------------------------------------------------------------------
- def update_cursor_rect
- # 光标位置 -1 为全选、-2 以下为单独选择 (使用者自身)
- if @index <= -2
- self.cursor_rect.set(0, (@index + 10) * 112, self.width - 32, 96)
- elsif @index == -1
- self.cursor_rect.set(0, 0, self.width - 32, @item_max * 112 - 20)
- else
- tpy = @index * 112 - self.oy
- self.cursor_rect.set(0, tpy, self.width - 32, 96)
- if @index < @top_row
- @top_row = @index
- self.oy = @top_row *112
- end
- if @index > @top_row+3
- @top_row = @index-3
- self.oy = @top_row *112
- end
- end
- end
- end
- #==============================================================================
- # ■ Window_MenuStatus
- #------------------------------------------------------------------------------
- # 显示菜单画面和同伴状态的窗口。
- #==============================================================================
- class Window_MenuStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化目标
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 480, 480)
- self.contents = Bitmap.new(width - 32, $game_party.actors.size*112)
- refresh
- @top_row = 0
- self.active = false
- self.index = -1
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @item_max = $game_party.actors.size
- for i in 0...$game_party.actors.size
- x = 64
- y = i * 112
- if i <=3
- self.contents.font.color = Color.new(255,255,0,255)
- self.contents.draw_text(x,y,340,32,"[出战]",2)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = Color.new(128,128,128,255)
- self.contents.draw_text(x,y,340,32,"[待机]",2)
- self.contents.font.color = normal_color
- end
- actor = $game_party.actors[i]
- draw_actor_graphic(actor, x - 40, y + 80)
- draw_actor_name(actor, x, y)
- draw_actor_class(actor, x + 144, y)
- draw_actor_level(actor, x, y + 32)
- draw_actor_state(actor, x + 90, y + 32)
- draw_actor_exp(actor, x, y + 64)
- draw_actor_hp(actor, x + 236, y + 32)
- draw_actor_sp(actor, x + 236, y + 64)
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新光标矩形
- #--------------------------------------------------------------------------
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- else
- tpy = @index * 112 - self.oy
- self.cursor_rect.set(0, tpy, self.width - 32, 96)
- if @index < @top_row
- @top_row = @index
- self.oy = @top_row *112
- end
- if @index > @top_row+3
- @top_row = @index-3
- self.oy = @top_row *112
- end
- end
- end
- end
- class Game_Party
- #--------------------------------------------------------------------------
- # ● 全灭判定
- #--------------------------------------------------------------------------
- def all_dead?
- # 同伴人数为 0 的情况下
- if $game_party.actors.size == 0
- return false
- end
- # 同伴中无人 HP 在 0 以上
- for i in 0..3
- if @actors[i] != nil and@actors[i].hp >0
- return false
- end
- end
- # 全灭
- return true
- end
- #--------------------------------------------------------------------------
- # ● 加入同伴
- # actor_id : 角色 ID
- #--------------------------------------------------------------------------
- def add_actor(actor_id)
- # 获取角色
- actor = $game_actors[actor_id]
- # 同伴人数未满 4 人、本角色不在队伍中的情况下
- if not @actors.include?(actor)
- # 添加角色
- @actors.push(actor)
- # 还原主角
- $game_player.refresh
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- class Scene_Menu
- # --------------------------------
- def initialize(menu_index = 0)
- @menu_index = menu_index
- @changer = 0
- @where = 0
- @checker = 0
- end
- # --------------------------------
- def main
- s1 = $data_system.words.item
- s2 = $data_system.words.skill
- s3 = $data_system.words.equip
- s4 = "状态"
- s5 = "记录"
- s6 = "离开游戏"
- s7 = "调整队伍"
- @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
- @command_window.index = @menu_index
- if $game_party.actors.size == 0
- @command_window.disable_item(0)
- @command_window.disable_item(1)
- @command_window.disable_item(2)
- @command_window.disable_item(3)
- end
- if $game_system.save_disabled
- @command_window.disable_item(4)
- end
- if $game_party.actors.size == 1
- @command_window.disable_item(6)
- end
- @playtime_window = Window_PlayTime.new
- @playtime_window.x = 0
- @playtime_window.y = 320
- @gold_window = Window_Gold.new
- @gold_window.x = 0
- @gold_window.y = 416
- @status_window = Window_MenuStatus.new
- @status_window.x = 160
- @status_window.y = 0
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @command_window.dispose
- @playtime_window.dispose
- @gold_window.dispose
- @status_window.dispose
- end
- # --------------------------------
- def update
- @command_window.update
- @playtime_window.update
- @gold_window.update
- @status_window.update
- if @command_window.active
- update_command
- return
- end
- if @status_window.active
- update_status
- return
- end
- end
- # --------------------------------
- def update_command
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Map.new
- return
- end
- if Input.trigger?(Input::C)
- if $game_party.actors.size == 0 and @command_window.index < 4
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- if $game_party.actors.size == 1 and @command_window.index ==6
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- case @command_window.index
- when 0
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Item.new
- when 1
- $game_system.se_play($data_system.decision_se)
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 2
- $game_system.se_play($data_system.decision_se)
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 3
- $game_system.se_play($data_system.decision_se)
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- ############################################################
- when 4
- #if $game_system.save_disabled
- # $game_system.se_play($data_system.buzzer_se)
- # return
- #end
- $game_system.se_play($data_system.decision_se)
- #$scene = Scene_Save.new
- $scene = Scene_Loadsave.new#运行存取档脚本
- ############################################################
- when 5
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_End.new
- when 6
- $game_system.se_play($data_system.decision_se)
- @checker = 0
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- end
- return
- end
- end
- # --------------------------------
- def update_status
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @command_window.active = true
- @status_window.active = false
- @status_window.index = -1
- return
- end
- if Input.trigger?(Input::C)
- case @command_window.index
- when 1
- if $game_party.actors[@status_window.index].restriction >= 2
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Skill.new(@status_window.index)
- when 2
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Equip.new(@status_window.index)
- when 3
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Status.new(@status_window.index)
- when 6
- $game_system.se_play($data_system.decision_se)
- if @status_window.index==0
- $game_system.se_play($data_system.cancel_se)
- return
- end
- if @checker == 0
- @changer = $game_party.actors[@status_window.index]
- @where = @status_window.index
- @checker = 1
- else
- $game_party.actors[@where] = $game_party.actors[@status_window.index]
- $game_party.actors[@status_window.index] = @changer
- @checker = 0
- @status_window.refresh
- end
-
- end
- return
- end
- end
- end
-
-
- #插件(升级加点,换队伍顺序,人物介绍,动态行走图)
-
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- # 作者: 柳柳
- #
- # 说明:这是功能我再比较早期的时候发布在幻森,不过那时候比较笨,方法很糟糕
- # 这次是拿上就可以用的。
- #
- # 感谢:Claimh的脚本使我想起这个功能重做了一遍,本想直接用他的,不过他的算法过分
- # 冗余了,没好意思用。
- #==============================================================================
- # 使用方法:默认情况下把静态图变为了走步图。如果想自行修改,提供功能如下:
- #
- # 角色走步图:draw_walk_actor_graphic
- # 角色转向图:draw_turn_actor_graphic
- #
- # 回复原有静态角色图:删除100行以后的内容。修改下面这个变量可以更改行走速度
- #==============================================================================
- WALK_REFRESH_FRAME_SPEED = 15 # 刷新的速度,越大越慢,你可以改为3左右试试看
- #==============================================================================
- # Window_Base
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # 初始化方法
- #--------------------------------------------------------------------------
- alias initialize_walk initialize
- def initialize(x, y, width, height)
- initialize_walk(x, y, width, height)
- @start_walk = false
- @turn_index = 0
- @turn_phase = 0
- end
- #--------------------------------------------------------------------------
- # ★ 角色行走图
- # actor : 角色
- # x : 描绘的 X 坐标
- # y : 描绘的 Y 坐标
- #--------------------------------------------------------------------------
- def draw_walk_actor_graphic(actor, x, y)
- bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
- cw = bitmap.width / 4
- ch = bitmap.height / 4
- @start_turn = true
- case @turn_phase
- when 0
- x_x = 0
- when 1
- x_x = cw
- when 2
- x_x = cw * 2
- when 3
- x_x = cw * 3
- end
- src_rect = Rect.new(x_x, 0, cw, ch)
- self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
- end
- #--------------------------------------------------------------------------
- # ★ 角色转向图
- # actor : 角色
- # x : 描绘的 X 坐标
- # y : 描绘的 Y 坐标
- #--------------------------------------------------------------------------
- def draw_turn_actor_graphic(actor, x, y)
- bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
- cw = bitmap.width / 4
- ch = bitmap.height / 4
- @start_turn = true
- case @turn_phase
- when 0
- x_x = 0
- when 1
- x_x = ch
- when 2
- x_x = ch * 3
- when 3
- x_x = ch * 2
- end
- src_rect = Rect.new(0, x_x, cw, ch)
- self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
- end
- #--------------------------------------------------------------------------
- # 更新(可别使用刷新,玩命耗费内存= =)
- #--------------------------------------------------------------------------
- alias walk_update update
- def update
- walk_update
- if @start_turn == true
- @turn_index += 1
- if @turn_index == WALK_REFRESH_FRAME_SPEED
- refresh
- @turn_index = 0
- @turn_phase = (@turn_phase+1)%4
- end
- end
- end
- end
- #==============================================================================
- # Window_Base
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # 把原有静态图改为动态走步图
- #--------------------------------------------------------------------------
- def draw_actor_graphic(actor, x, y)
- draw_walk_actor_graphic(actor, x, y)
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码
想当年我曾经整了一个,不知这个行不行。 系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~ |
|