- 注册时间
- 2008-1-18
- 最后登录
- 2019-6-30
④见习
- 积分
- 347
|
发表于 2010-1-27 17:19:14
|
显示全部楼层
显示大图 改法
Window_Item改32数字
刷新光标矩形 改32数字
--------------------------------------
大图边上能显示一大段文字
Window_Help修改
设置文本
------------------------------------
以下是脚本- #==============================================================================
- # ■ Window_Item
- #------------------------------------------------------------------------------
- # 物品画面、战斗画面、显示浏览物品的窗口。
- #==============================================================================
- class Window_Item < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(20, 72, 640, 400)
- @column_max = 2
- refresh
- self.index = 0
- # 战斗中的情况下将窗口移至中央并将其半透明化
- if $game_temp.in_battle
- self.y = 64
- self.height = 256
- self.back_opacity = 160
- end
- end
- #--------------------------------------------------------------------------
- # ● 获取物品
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- # 添加报务
- for i in 1...$data_items.size
- if $game_party.item_number(i) > 0
- @data.push($data_items[i])
- end
- end
- # 在战斗中以外添加武器、防具
- unless $game_temp.in_battle
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0
- @data.push($data_weapons[i])
- end
- end
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0
- @data.push($data_armors[i])
- end
- end
- end
- # 如果项目数不是 0 就生成位图、重新描绘全部项目
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 52)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- if item.is_a?(RPG::Item) and
- $game_party.item_can_use?(item.id)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 52
- rect = Rect.new(x, y, self.width / @column_max - 52, 52)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 52, 52), opacity)
- self.contents.draw_text(x + 50, y, 212, 52, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 52, ":", 1)
- self.contents.draw_text(x + 256, y, 24, 52, number.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● 刷新帮助文本
- #--------------------------------------------------------------------------
- def page_row_max
- # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
- return (self.height - 52) / 52
- end
- #--------------------------------------------------------------------------
- # ● 获取 1 页可以显示的项目数
- #--------------------------------------------------------------------------
- def page_item_max
- # 将行数 page_row_max 乘上列数 @column_max
- return page_row_max * @column_max
- end
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- #--------------------------------------------------------------------------
- # ● 刷新光标矩形
- #--------------------------------------------------------------------------
- def update_cursor_rect
- # 光标位置不满 0 的情况下
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # 获取当前的行
- row = @index / @column_max
- # 当前行被显示开头行前面的情况下
- if row < self.top_row
- # 从当前行向开头行滚动
- self.top_row = row
- end
- # 当前行被显示末尾行之后的情况下
- if row > self.top_row + (self.page_row_max - 1)
- # 从当前行向末尾滚动
- self.top_row = row - (self.page_row_max - 1)
- end
- # 计算光标的宽
- cursor_width = self.width / @column_max - 32
- # 计算光标坐标
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 52 - self.oy
- # 更新国标矩形
- self.cursor_rect.set(x, y, cursor_width, 52)
- end
- #-----------------------
- def update
- super
- # 可以移动光标的情况下
- if self.active and @item_max > 0 and @index >= 0
- # 方向键下被按下的情况下
-
- # R 键被按下的情况下
- if Input.repeat?(Input::R)
- # 显示的最后行在数据中最后行上方的情况下
- if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
- # 光标向后移动一页
- $game_system.se_play($data_system.cursor_se)
- @index = [@index + self.page_item_max, @item_max - 1].min
- self.top_row += self.page_row_max
- end
- end
- # L 键被按下的情况下
- if Input.repeat?(Input::L)
- # 显示的开头行在位置 0 之后的情况下
- if self.top_row > 0
- # 光标向前移动一页
- $game_system.se_play($data_system.cursor_se)
- @index = [@index - self.page_item_max, 0].max
- self.top_row -= self.page_row_max
- end
- end
- end
- # 刷新帮助文本 (update_help 定义了继承目标)
- if self.active and @help_window != nil
- update_help
- end
- # 刷新光标矩形
- update_cursor_rect
- end
-
- end
复制代码- #==============================================================================
- # ■ Window_Help
- #------------------------------------------------------------------------------
- # 特技及物品的说明、角色的状态显示的窗口。
- # 若要更改属性,请搜索element_set={1=>"火",2=>"冰",3=>"光",4=>"暗"} 改成对应属性即可
- #==============================================================================
- UNSHOW_STATE=[1,2,3,4,5]#记录不显示的状态数组
- UNSHOW_ELEMENT=[1,2,3,4,5]#记录不显示的属性数组
- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(150,200, 180, 430)
- self.opacity = 150
- self.z=150
- self.visible = false
- self.contents = Bitmap.new(width - 32, height - 32)
- description=""
- @item=nil
- @armor=nil
- @weapon=nil
- end
- #--------------------------------------------------------------------------
- # ● 设置文本
- # text : 窗口显示的字符串
- # align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
- #--------------------------------------------------------------------------
- def set_text(data, align=nil)
- # 如果文本和对齐方式的至少一方与上次的不同
- if align != nil
- # 再描绘窗口和文本
- self.width = 640
- self.height = 64
- self.x=0
- self.y=0
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.font.size = 20
- self.contents.draw_text(4, 0, self.width - 48, 32, data, align)
- self.visible = true
- return
- end
- if data == nil
- self.visible=false
- @data = nil
- end
- if data != nil && @data != data
- @data=data
- self.visible=true
- self.width = 180
- self.height = 200
- self.x=180
- self.y=430
- self.contents = Bitmap.new(width - 32, height - 32)
- case @data
- when RPG::Item
- set_item_text(@data)
- when RPG::Weapon
- set_weapon_text(@data)
- when RPG::Armor
- set_armor_text(@data)
- when RPG::Skill
- set_skill_text(@data)
- end
- else
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置敌人
- # enemy : 要显示名字和状态的敌人
- #--------------------------------------------------------------------------
- def set_enemy(enemy)
- text = enemy.name
- state_text = make_battler_state_text(enemy, 0, false)
- if state_text != ""
- text += " " + state_text
- end
- set_text(text, 1)
- @data=nil
- end
- #--------------------------------------------------------------------------
- # ● 设置角色
- # actor : 要显示状态的角色
- #--------------------------------------------------------------------------
- def set_actor(actor)
- if actor != @actor
- self.width = 640
- self.height = 64
- self.x=0
- self.y=0
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.clear
- self.contents.font.size=20
- self.contents.font.color = normal_color
- draw_actor_name(actor, 4, 0)
- draw_actor_state(actor, 140, 0)
- draw_actor_hp(actor, 284, 0)
- draw_actor_sp(actor, 460, 0)
- @actor = actor
- @text = nil
- self.visible = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 校正帮助窗口位置
- #--------------------------------------------------------------------------
- def set_pos(x,y,width,oy,index,column_max)
- #光标坐标
- cursor_width = width / column_max - 32
- xx = index % column_max * (cursor_width + 32)
- yy = index / column_max * 32 - oy
- self.x=xx+x+150
- self.y=yy+y+30
- if self.x+self.width>640
- self.x=640-self.width
- end
- if self.y+self.height>480
- self.y=480-self.height
- end
- end
- end
- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 物品帮助窗口
- #--------------------------------------------------------------------------
- def set_item_text(item)
- @item=item
- description=""
- description+=@item.description
- x=0
- y=0
- # 取得屬性、附加狀態、解除狀態之副本
- element_set = @item.element_set.clone
- plus_state_set = @item.plus_state_set.clone
- minus_state_set = @item.minus_state_set.clone
- # 過濾不顯示的描述
- element_set -= UNSHOW_ELEMENT
- plus_state_set -= UNSHOW_STATE
- minus_state_set -= UNSHOW_STATE
- height=1 #依要显示的内容确定高
- #由描叙确定高
- height+=description.size/3/10
- if description.size%10!=0
- height+=1
- end
- height+=3 #空行,效果范围,价格
- if @item.recover_hp_rate!=0 #HP 回复率。
- height+=1
- end
- if @item.recover_hp!=0 #HP 回复量。
- height+=1
- end
- if @item.recover_sp_rate!=0 #SP 回复率。
- height+=1
- end
- if @item.recover_sp!=0 #SP 回复量。
- height+=1
- end
- if @item.parameter_type!=0 #增加能力值
- height+=1
- end
- if element_set.empty?!=true #属性。为属性 ID 的数组
- height+=1
- end
- if plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
- height+=plus_state_set.size
- end
- if minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
- height+=minus_state_set.size
- end
- self.height=height*15+40+15
- self.contents = Bitmap.new(self.width - 32,self.height - 32)
- self.contents.clear
- #描绘名字
- text=@item.name
- self.contents.font.color =text_color(6)
- self.contents.font.size=18
- if text!=nil
- self.visible = true
- self.contents.draw_text(0,0, @item.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
- #由特技属性确定高
- #效果范围
- scope = {0=>"特殊物品",1=>"敌单体",2=>"敌全体",3=>"己方单体",4=>"己方全体",5=>"己方昏死单体",6=>"己方昏死全体",7=>"使用者"}#HASH表
- text="范围:"+scope[@item.scope]
- x=0
- y+=2 #空一行
- 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
- text="价格:"+@item.price.to_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)
-
- #HP 回复率
- if @item.recover_hp_rate!=0
- x=0
- y+=1
- text="回复HP:"+@item.recover_hp_rate.to_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)
- end
- #HP回复量
- if @item.recover_hp!=0
- x=0
- y+=1
- text="回复HP:"+@item.recover_hp.to_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)
- end
- #SP 回复率
- if @item.recover_sp_rate!=0
- x=0
- y+=1
- text="回复SP:"+@item.recover_sp_rate.to_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)
- end
- #SP 回复量
- if @item.recover_sp!=0
- x=0
- y+=1
- text="回复SP:"+@item.recover_sp.to_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)
- end
- #增加能力值
- if @item.parameter_type!=0
- parameter_type={1=>"MaxHP",2=>"MaxSP",3=>$data_system.words.str,4=>$data_system.words.dex,5=>$data_system.words.agi,6=>$data_system.words.int}
- x=0
- y+=1
- if @item.parameter_points>0
- text="增益:"+parameter_type[@item.parameter_type]+" +"+@item.parameter_points.to_s
- else
- text="减少:"+parameter_type[@item.parameter_type]+@item.parameter_points.to_s
- end
- 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 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 plus_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...plus_state_set.size
- y+=1
- text=$data_states[plus_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
- #解除状态
- if minus_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...minus_state_set.size
- y+=1
- text=$data_states[minus_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
- end
- end
- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 武器帮助窗口
- #--------------------------------------------------------------------------
-
- def set_weapon_text(weapon)
- @weapon=weapon
- description=""
- description+=@weapon.description
- # 取得屬性、附加狀態、解除狀態之副本
- element_set = @weapon.element_set.clone
- plus_state_set = @weapon.plus_state_set.clone
- minus_state_set = @weapon.minus_state_set.clone
- # 過濾不顯示的描述
- element_set -= UNSHOW_ELEMENT
- plus_state_set -= UNSHOW_STATE
- minus_state_set -= UNSHOW_STATE
- x=0
- y=0
- height=1 #依要显示的内容确定高
- #由描叙确定高
- height+=description.size/3/10
- if description.size%10!=0
- height+=1
- end
- height+=4 #2个空行,攻击,价格
- if @weapon.pdef!=0 #物理防御
- height+=1
- end
- if @weapon.mdef!=0 #魔法防御
- height+=1
- end
- if @weapon.str_plus!=0 #力量
- height+=1
- end
- if @weapon.dex_plus!=0#体质
- height+=1
- end
- if @weapon.agi_plus!=0#敏捷
- height+=1
- end
- if @weapon.int_plus!=0 #智力
- height+=1
- end
- if element_set.empty?!=true #属性。为属性 ID 的数组
- height+=1
- end
- if plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
- height+=plus_state_set.size
- end
- if minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
- height+=minus_state_set.size
- end
- self.height=height*15+40+15
- self.contents = Bitmap.new(self.width - 32,self.height - 32)
- self.contents.clear
- #描绘名字
- text=@weapon.name
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=18
- if text!=nil
- self.visible = true
- self.contents.draw_text(0,0, @weapon.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="攻击:"+@weapon.atk.to_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
- text="价格:"+@weapon.price.to_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)
- if @weapon.pdef!=0 #物理防御
- x=0
- y+=1
- text="物理防御:"+@weapon.pdef.to_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)
- end
- if @weapon.mdef!=0 #魔法防御
- x=0
- y+=1
- text="魔法防御:"+@weapon.mdef.to_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)
- end
- #武器属性
- if element_set.empty? != true #属性。为属性 ID 的数组
- text="武器属性"
- x=0
- y+=1
- 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...element_set.size
- y+=1
- text=$data_system.elements[element_set[i]] + " "
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- end
- #附加状态
- if plus_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...plus_state_set.size
- y+=1
- text=$data_states[plus_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
- #解除状态
- if minus_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...minus_state_set.size
- y+=1
- text=$data_states[minus_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 @weapon.str_plus!=0 #力量
- x=0
- y+=1
- if @weapon.str_plus > 0
- text=$data_system.words.str+" + "+@weapon.str_plus.to_s
- else
- str_minus=-@weapon.str_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 @weapon.dex_plus!=0#体质
- x=0
- y+=1
- if @weapon.dex_plus > 0
- text=$data_system.words.dex+" + "+@weapon.dex_plus.to_s
- else
- dex_minus=-@weapon.dex_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 @weapon.agi_plus!=0#敏捷
- x=0
- y+=1
- if @weapon.agi_plus > 0
- text=$data_system.words.agi+" + "+@weapon.agi_plus.to_s
- else
- agi_minus=-@weapon.agi_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 @weapon.int_plus!=0 #智力
- x=0
- y+=1
- if @weapon.int_plus > 0
- text=$data_system.words.int+" + "+@weapon.int_plus.to_s
- else
- int_minus=-@weapon.int_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 Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 防具帮助窗口
- #--------------------------------------------------------------------------
- def set_armor_text(armor)
- @armor=armor
- description=""
- description+=@armor.description
- # 取得屬性、附加狀態、解除狀態之副本
- 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
- #描绘名字
- text=@armor.name
- self.contents.font.color = text_color(6)#颜色脚本
- 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="价格:"+@armor.price.to_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
- if @armor.pdef!=0 #物理防御
- text="物理防御:"+@armor.pdef.to_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="魔法防御:"+@armor.mdef.to_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+" + "+@armor.str_plus.to_s
- else
- str_minus=-@armor.str_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+" + "+@armor.dex_plus.to_s
- else
- dex_minus=-@armor.dex_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+" + "+@armor.agi_plus.to_s
- else
- agi_minus=-@armor.agi_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+" + "+@armor.int_plus.to_s
- else
- int_minus=-@armor.int_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 Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 技能帮助窗口
- #--------------------------------------------------------------------------
- def set_skill_text(skill)
- @skill=skill
- description=""
- description+=@skill.description
- # 取得屬性、附加狀態、解除狀態之副本
- element_set = @skill.element_set.clone
- plus_state_set = @skill.plus_state_set.clone
- minus_state_set = @skill.minus_state_set.clone
- # 過濾不顯示的描述
- element_set -= UNSHOW_ELEMENT
- plus_state_set -= UNSHOW_STATE
- minus_state_set -= UNSHOW_STATE
- x=0
- y=0
- height=1 #依要显示的内容确定高
- #由描叙确定高
- height+=description.size/3/10
- if description.size%10!=0
- height+=1
- end
- height+=4 #空行,效果范围,消费SP,命中率
- if @skill.power!=0 #威力,威力为0,则可能为状态魔法
- height+=1
- end
- if element_set.empty?!=true #属性。为属性 ID 的数组
- height+=1
- end
- if plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
- height+=plus_state_set.size
- end
- if minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
- height+=minus_state_set.size
- end
- self.height=height*15+40+15
- self.contents = Bitmap.new(self.width - 32,self.height - 32)
- self.contents.clear
- #描绘名字
- text=@skill.name
- self.contents.font.color =text_color(6)
- self.contents.font.size=18
- if text!=nil
- self.visible = true
- self.contents.draw_text(0,0, @skill.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
- text
- if x==10#每行10个字
- x=0
- y+=1
- end
- end
- #由特技属性确定高
- #效果范围
-
- scope = {0=>"特殊技能",1=>"敌单体",2=>"敌全体",3=>"己方单体",4=>"己方全体",5=>"己方昏死单体",6=>"己方昏死全体",7=>"使用者"}#HASH表
- text="范围:"+scope[@skill.scope]
- x=0
- y+=2 #空一行
- 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)
-
- #威力
- if @skill.power!=0
- x=0
- y+=1
- c=@skill.power > 0 ? @skill.power : -1* @skill.power
- text="威力:"+c.to_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)
- end
- #描绘消费SP
- x=0
- y+=1
- text="消耗SP:"+@skill.sp_cost.to_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
- text="命中率:"+@skill.hit.to_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)
- #攻击属性
-
- 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 plus_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...plus_state_set.size
- y+=1
- text=$data_states[plus_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
- #解除状态
- if minus_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...minus_state_set.size
- y+=1
- text=$data_states[minus_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
- end
- end
- class Window_Item < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 刷新帮助文本
- #--------------------------------------------------------------------------
- def update_help
- # @help_window.set_text(self.item == nil ? "" : self.item.description)
- @help_window.set_text(item)
- #校正帮助窗口位置
- @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
- end
- end
- class Window_Skill < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 刷新帮助文本
- #--------------------------------------------------------------------------
- def update_help
- # @help_window.set_text(self.skill == nil ? "" : self.skill.description)
- @help_window.set_text(skill)
- #校正帮助窗口位置
- @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
- end
- end
- class Window_EquipRight < Window_Selectable
- def update_help
- # @help_window.set_text(self.item == nil ? "" : self.item.description)
- @help_window.set_text(item)
- #校正帮助窗口位置
- @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
- end
- end
- class Window_EquipItem < Window_Selectable
- def update_help
- # @help_window.set_text(self.item == nil ? "" : self.item.description)
- @help_window.set_text(item)
- #校正帮助窗口位置
- @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
- end
- end
- class Window_ShopBuy < Window_Selectable
- def update_help
- @help_window.set_text(item)
- #校正帮助窗口位置
- @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
- end
- end
- class Window_ShopSell < Window_Selectable
- def update_help
- @help_window.set_text(item)
- #校正帮助窗口位置
- @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
- end
- end
复制代码 |
|