赞 | 1 |
VIP | 246 |
好人卡 | 87 |
积分 | 1 |
经验 | 34142 |
最后登录 | 2015-1-15 |
在线时间 | 323 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 55
- 在线时间
- 323 小时
- 注册时间
- 2010-8-21
- 帖子
- 666
|
回复 u566 的帖子
不知道这些是哪个写的...写得乱就不说了,滥用实例变量,不释放图片,不缩进..............等等问题.......
我只解决了4个问题,当然包括LZ的那个问题...下面代码"紧"插到Main前:- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 防具帮助窗口
- #--------------------------------------------------------------------------
- def set_armor_text(armor)
- @armor=armor
- description=""
- [email protected]
- # 取得屬性、附加狀態、解除狀態之副本
- element_set = @armor.guard_element_set.clone
- guard_state_set = @armor.guard_state_set.clone
- # 過濾不顯示的描述
- element_set -= UNSHOW_ELEMENT
- guard_state_set -= UNSHOW_STATE
- x=0
- y=0
- height=1 #依要显示的内容确定高
- #由描叙确定高
- height+=description.size/3/10
- if description.size%10 !=0
- height+=1
- end
- height+=2 #2个空行,价格
- if @armor.pdef !=0 #物理防御
- height+=1
- end
- if @armor.mdef !=0 #魔法防御
- height+=1
- end
- if @armor.str_plus !=0 #力量
- height+=1
- end
- if @armor.dex_plus !=0#体质
- height+=1
- end
- if @armor.agi_plus !=0#敏捷
- height+=1
- end
- if @armor.int_plus !=0 #智力
- height+=1
- end
- if element_set.empty? != true #属性防御。为属性 ID 的数组
- height+=1
- end
- if guard_state_set.empty? != true #状态防御。为状态 ID 的数组
- height+=guard_state_set.size
- end
- self.height=height*16+70
- self.contents = Bitmap.new(self.width - 32,self.height - 32)
- self.contents.clear
- #描绘名字
- [email protected]
- self.contents.font.color = text_color(1)#颜色脚本
- self.contents.font.size=18
- if text!=nil
- self.visible = true
- self.contents.draw_text(0,0, @armor.name.size*7, 20, text, 0)
- else
- self.visible = false
- end
- x=0
- y+=1
- text=description
- #描绘描叙
- while ((text = description.slice!(/./m)) != nil)
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x*15, y*15+5, 14, 14, text, 0)
- x+=1
- if x==10#每行10个字
- x=0
- y+=1
- end
- end
- #由特技属性确定高
-
-
- #价格
- x=0
- y+=2#空行
- text="价格:"[email protected]_s
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- x=0
- y+=1
- #耐久度
- #dur_set = @weapon.dur_set
-
- dur = @armor.dur
- text = "耐久度: #{dur}"
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x-1, y*15+50, text.size*6, 14, text, 0)
- #可镶嵌次数
- text = "可镶嵌次数: "[email protected]_s
- self.contents.font.color = text_color(4)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x-1, y*15+35, text.size*6, 14, text, 0)
-
-
- if @armor.pdef!=0 #物理防御
- text="物理防御:"[email protected]_s
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- x=0
- y+=1
- end
- if @armor.mdef!=0 #魔法防御
- text="魔法防御:"[email protected]_s
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- x=0
- y+=1
- end
- #属性防御
- if element_set.empty? !=true #属性。为属性 ID 的数组
- text="属性防御:"
- for i in 0...element_set.size
- text+=$data_system.elements[element_set[i]]+" "
- end
- x=0
- y+=1
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- #状态防御
- if guard_state_set.empty?!=true #附加状态。为状态 ID 的数组
- text="状态防御:"
- x=0
- y+=1
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- y-=1
- x+=text.size*5
- for i in 0...guard_state_set.size
- y+=1
- text=$data_states[guard_state_set[i]].name
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- end
-
- # y+=1 #空行
- if @armor.str_plus!=0 #力量
- x=0
- y+=1
- if @armor.str_plus > 0
- text=$data_system.words.str+" + "[email protected]_plus.to_s
- else
- [email protected]_plus
- text=$data_system.words.str+" - "+str_minus.to_s
- end
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- if @armor.dex_plus!=0#体质
- x=0
- y+=1
- if @armor.dex_plus > 0
- text=$data_system.words.dex+" + "[email protected]_plus.to_s
- else
- [email protected]_plus
- text=$data_system.words.dex+" - "+dex_minus.to_s
- end
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- if @armor.agi_plus!=0#敏捷
- x=0
- y+=1
- if @armor.agi_plus > 0
- text=$data_system.words.agi+" + "[email protected]_plus.to_s
- else
- [email protected]_plus
- text=$data_system.words.agi+" - "+agi_minus.to_s
- end
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- if @armor.int_plus!=0 #智力
- x=0
- y+=1
- if @armor.int_plus > 0
- text=$data_system.words.int+" + "[email protected]_plus.to_s
- else
- [email protected]_plus
- text=$data_system.words.int+" - "+int_minus.to_s
- end
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- end
- end
- class Scene_Combine
- def make_new_equip(combine1, combine2)
- $game_switches[49] = true
- result = rand(100)
- # 随机破损
- if result >= $game_variables[50]
- $game_party.actors[@actor_index].equip(@equip_window.index, 0, 1)
- $game_variables[49] = 1
- else # 成功的场合
- # 目标为武器的场合
- if @equip_window.index == 0
- iii = $data_weapons.size
- # 获取武器ID
- kkk = $game_party.actors[@actor_index].weapon_id
- # 末尾追加当前武器
- $data_weapons.push($data_weapons[kkk])
- $data_weapons[-1].id = $data_weapons.size-1
- # 追加不为空时,修改名称
- if $new_extra != nil
- $data_weapons[-1].name = ($new_extra + "-" + $data_weapons[kkk].name)
- end
- if $new_element_plus != nil
- $data_weapons[-1].name = ($new_element_plus + "-" + $data_weapons[kkk].name)
- end
- $data_weapons[-1].description = ($data_weapons[kkk].description + "u" + [$data_weapons[kkk].combine - 1].to_s)
- $data_weapons[-1].atk = $data_weapons[kkk].atk + ($atk_plus2 * (80 + rand(41)) / 100).to_i
- $data_weapons[-1].pdef = $data_weapons[kkk].pdef + ($pdef_plus2 * (80 + rand(41)) / 100).to_i
- $data_weapons[-1].mdef = $data_weapons[kkk].mdef + ($mdef_plus2 * (80 + rand(41)) / 100).to_i
- $data_weapons[-1].str_plus = $data_weapons[kkk].str_plus + ($str_plus2 * (80 + rand(41)) / 100).to_i
- $data_weapons[-1].dex_plus = $data_weapons[kkk].dex_plus + ($dex_plus2 * (80 + rand(41)) / 100).to_i
- $data_weapons[-1].agi_plus = $data_weapons[kkk].agi_plus + ($agi_plus2 * (80 + rand(41)) / 100).to_i
- $data_weapons[-1].int_plus = $data_weapons[kkk].int_plus + ($int_plus2 * (80 + rand(41)) / 100).to_i
- $data_weapons[-1].element_set = $element_plus2
- $game_party.gain_weapon($data_weapons.size-1, 1)
- for jjj in 1...$data_classes.size
- if $data_classes[jjj].weapon_set.include?(kkk)
- $data_classes[jjj].weapon_set.push($data_weapons[-1].id)
- end
- end
- else
- iii = $data_armors.size
- case @equip_window.index
- when 1
- kkk = $game_party.actors[@actor_index].armor1_id
- when 2
- kkk = $game_party.actors[@actor_index].armor2_id
- when 3
- kkk = $game_party.actors[@actor_index].armor3_id
- when 4
- kkk = $game_party.actors[@actor_index].armor4_id
- end
- $data_armors[iii] = $data_armors[kkk].clone
- $data_armors[iii].id = iii
- if $new_extra != nil
- $data_armors[iii].name = ($new_extra + "-" + $data_armors[kkk].name)
- end
- if $new_element_plus != nil
- $data_armors[iii].name = ($new_element_plus + "-" + $data_armors[kkk].name)
- end
- $data_armors[iii].description = ($data_armors[kkk].description + "u" + [$data_armors[kkk].combine - 1].to_s)
- $data_armors[iii].eva = $data_armors[kkk].eva + ($eva_plus2 * (80 + rand(41)) / 100).to_i
- $data_armors[iii].pdef = $data_armors[kkk].pdef + ($pdef_plus2 * (80 + rand(41)) / 100).to_i
- $data_armors[iii].mdef = $data_armors[kkk].mdef + ($mdef_plus2 * (80 + rand(41)) / 100).to_i
- $data_armors[iii].str_plus = $data_armors[kkk].str_plus + ($str_plus2 * (80 + rand(41)) / 100).to_i
- $data_armors[iii].dex_plus = $data_armors[kkk].dex_plus + ($dex_plus2 * (80 + rand(41)) / 100).to_i
- $data_armors[iii].agi_plus = $data_armors[kkk].agi_plus + ($agi_plus2 * (80 + rand(41)) / 100).to_i
- $data_armors[iii].int_plus = $data_armors[kkk].int_plus + ($int_plus2 * (80 + rand(41)) / 100).to_i
- $data_armors[iii].guard_element_set = $element_plus2
- $game_party.gain_armor(iii, 1)
- for jjj in 1...$data_classes.size
- if $data_classes[jjj].armor_set.include?(kkk)
- $data_classes[jjj].armor_set.push(iii)
- end
- end
- end
- $game_party.actors[@actor_index].equip(@equip_window.index, iii, 1)
- $game_variables[49] = 0
- end
- # 失去合成物
- $game_party.lose_item(combine2.id, 1)
- @epro_window.dispose
- $scene = Scene_Map.new
- end
-
- def update_combine
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切换到菜单画面
- @combine_window.active = false
- @equip_window.active = true
- return
- end
- if Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- @combine_window.active = false
- @combine2 = @combine_window.item
- @epro_window = Window_EPro.new(@combine1, @combine2)
- @epro_window.visible = true
- @epro_window.active = false
- @ccconfirm_window.active = true
- @ccconfirm_window.visible = true
- end
- end
- def update_equip
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切换到菜单画面
- $game_switches[49] = true
- $game_variables[49] = 2
- $scene = Scene_Map.new
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- return unless @combine_window.item
- case @equip_window.index
- when 0
- @combine1 = $data_weapons[$game_party.actors[@actor_index].weapon_id]
- when 1
- @combine1 = $data_armors[$game_party.actors[@actor_index].armor1_id]
- when 2
- @combine1 = $data_armors[$game_party.actors[@actor_index].armor2_id]
- when 3
- @combine1 = $data_armors[$game_party.actors[@actor_index].armor3_id]
- when 4
- @combine1 = $data_armors[$game_party.actors[@actor_index].armor4_id]
- end
- $game_system.se_play($data_system.decision_se)
- if @combine1 == nil
- return
- end
- if @combine1.combine <= 0
- return
- end
- @combine_window.active = true
- @equip_window.active = false
- return
- end
- # 按下 R 键的情况下
- if Input.trigger?(Input::R)
- # 演奏光标 SE
- $game_system.se_play($data_system.cursor_se)
- # 移至下一位角色
- @actor_index += 1
- @actor_index %= $game_party.actors.size
- # 切换到别的装备画面
- $scene = Scene_Combine.new(@actor_index)
- return
- end
- # 按下 L 键的情况下
- if Input.trigger?(Input::L)
- # 演奏光标 SE
- $game_system.se_play($data_system.cursor_se)
- # 移至上一位角色
- @actor_index += $game_party.actors.size - 1
- @actor_index %= $game_party.actors.size
- # 切换到别的装备画面
- $scene = Scene_Combine.new(@actor_index)
- return
- end
- end
- end
- class Scene_Save < Scene_File
- #--------------------------------------------------------------------------
- # ● 写入存档数据
- # file : 写入用文件对像 (已经打开)
- #--------------------------------------------------------------------------
- def write_save_data(file)
- # 生成描绘存档文件用的角色图形
- characters = []
- for i in 0...$game_party.actors.size
- 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)
- Marshal.dump($data_weapons, file)
- Marshal.dump($data_armors, file)
- Marshal.dump($data_classes, file)
- end
- end
- class Scene_Load < Scene_File
- #--------------------------------------------------------------------------
- # ● 读取存档数据
- # file : 读取用文件对像 (已经打开)
- #--------------------------------------------------------------------------
- def read_save_data(file)
- # 读取描绘存档文件用的角色数据
- characters = Marshal.load(file)
- # 读取测量游戏时间用画面计数
- Graphics.frame_count = Marshal.load(file)
- # 读取各种游戏对像
- $game_system = Marshal.load(file)
- $game_switches = Marshal.load(file)
- $game_variables = Marshal.load(file)
- $game_self_switches = Marshal.load(file)
- $game_screen = Marshal.load(file)
- $game_actors = Marshal.load(file)
- $game_party = Marshal.load(file)
- $game_troop = Marshal.load(file)
- $game_map = Marshal.load(file)
- $game_player = Marshal.load(file)
- $data_weapons = Marshal.load(file)
- $data_armors = Marshal.load(file)
- $data_classes = Marshal.load(file)
- # 魔法编号与保存时有差异的情况下
- # (加入编辑器的编辑过的数据)
- if $game_system.magic_number != $data_system.magic_number
- # 重新装载地图
- $game_map.setup($game_map.map_id)
- $game_player.center($game_player.x, $game_player.y)
- end
- # 刷新同伴成员
- $game_party.refresh
- end
- end
复制代码 还有不少小BUG,不过量太大了,Scripts.rxdata就有270几KB,默认只有118KB。。。。就放弃了 |
|