Project1
标题: 请问怎样去掉该脚本后的@字样 [打印本页]
作者: qkqwe 时间: 2015-3-14 19:08
标题: 请问怎样去掉该脚本后的@字样 本帖最后由 qkqwe 于 2015-3-14 19:09 编辑
在站里找了一个能够普通攻击两次和群攻的脚本,但是在装备栏和物品栏中总是显示红线内的”@“字样,请问该怎么去掉呢?下面附上脚本,麻烦诸位大神了!
附上问题图:
附上脚本:
#==============================================================================
# ■仿仙剑的群体攻击(鞭)、仙风云体步(仙女剑)以及敌人的双次攻击效果
#------------------------------------------------------------------------------
# 实现角色的攻击特点、武器的攻击特点、敌人的攻击特点 Ver 1.00
#==============================================================================
#用前须知
#首先请搞清楚,群攻是指林月如的鞭系那种攻击对方全体的普通攻击;
#仙风云体步是指赵灵儿用双剑攻击的每回合对同一敌人的两次普通攻击;
#在这个仿仙剑一的版本中,敌人的仙风云体步设置为双次攻击效果
#1.设置群体攻击的敌人,只需要在数据库敌人属性名字后面加后缀"@群攻"
#2.设置仙风云体步的敌人,需要在数据库敌人属性名字后面加后缀"@@仙风"注意是两个"@"
#3.如果一个敌人既是群攻又是仙风云体步,敌人属性名字后面加后缀"@群攻@仙风"
#4.设置群体攻击的武器,只需要在数据库武器属性名字后面加后缀"@群攻"
#5.设置仙风云体步的武器,需要在数据库敌人属性名字后面加后缀"@@仙风"同样注意是两个"@"
#6.如果一件武器既是群攻又是仙风云体术,武器属性名字后面加后缀"@群攻@仙风"
#7.如果有一个状态的效果是仙风云体术,请用下面的这个变量存储该状态的ID
Xianfengstate = 18
#--------------------------------------------------------------------------
# ● 去后缀处理
#--------------------------------------------------------------------------
class Window_Base < Window
def draw_item_name( item, x, y)
if item == nil
return
end
bitmap = RPG::Cache .icon ( item.icon_name )
self .contents .blt ( x, y + 4 , bitmap, Rect.new ( 0 , 0 , 24 , 24 ) )
self .contents .font .color = normal_color
self .contents .draw_text ( x + 28 , y, 212 , 32 , item.name .split ( "@" ) [ 0 ] )
end
end
class Game_Enemy < Game_Battler
def name
return $data_enemies [ @enemy_id] .name .split ( "@" ) [ 0 ]
end
def ifQungong
###如果要改变敌人群体攻击属性的后缀,改下面
return $data_enemies [ @enemy_id] .name .split ( "@" ) [ 1 ] == "群攻"
end
def ifXianfeng
###如果要改变敌人群体攻击属性的后缀,改下面
return $data_enemies [ @enemy_id] .name .split ( "@" ) [ 2 ] == "仙风"
end
end
#--------------------------------------------------------------------------
# ● 重写攻击情况下的脚本
#--------------------------------------------------------------------------
class Scene_Battle
#--------------------------------------------------------------------------
# ● 生成行动循序
#--------------------------------------------------------------------------
def make_action_orders
# 初始化序列 @action_battlers
@action_battlers = [ ]
# 添加敌人到 @action_battlers 序列
for enemy in $game_troop .enemies
@action_battlers .push ( enemy)
if enemy.ifXianfeng
@action_battlers .push ( enemy)
end
end
# 添加角色到 @action_battlers 序列
for actor in $game_party .actors
@action_battlers .push ( actor)
if ( actor.current_action .basic == 0 and actor.restriction == 0 and $data_weapons [ actor.weapon_id ] .name .split ( "@" ) [ 2 ] == "仙风" )
@action_battlers .push ( actor)
else
if actor.state ?( Xianfengstate)
@action_battlers .push ( actor)
end
end
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 make_basic_action_result
# 攻击的情况下
if @active_battler .current_action .basic == 0
# 设置攻击 ID
@animation1_id = @active_battler .animation1_id
@animation2_id = @active_battler .animation2_id
# 行动方的战斗者是敌人的情况下
if @active_battler .is_a ?( Game_Enemy)
if @active_battler .restriction == 3
target = $game_troop .random_target_enemy
elsif @active_battler .restriction == 2
target = $game_party .random_target_actor
else
index = @active_battler .current_action .target_index
target = $game_party .smooth_target_actor ( index)
end
end
# 行动方的战斗者是角色的情况下
if @active_battler .is_a ?( Game_Actor)
if @active_battler .restriction == 3
target = $game_party .random_target_actor
elsif @active_battler .restriction == 2
target = $game_troop .random_target_enemy
else
index = @active_battler .current_action .target_index
target = $game_troop .smooth_target_enemy ( index)
end
end
# 设置对像方的战斗者序列
@target_battlers = [ target]
# 如果敌人有“群攻”标记
if @active_battler .is_a ?( Game_Enemy)
if @active_battler .ifQungong
if @active_battler .restriction == 0
@target_battlers = [ ]
for target in $game_party .actors
if target.exist ?
@target_battlers .push ( target)
end
end
end
end
end
# 如果角色标有群攻或者武器含有“群攻”标记
if @active_battler .is_a ?( Game_Actor)
###如果要改变武器群体攻击属性的后缀,改下面
if $data_weapons [ @active_battler.weapon_id ] .name .split ( "@" ) [ 1 ] == "群攻"
if @active_battler .restriction == 0
@target_battlers = [ ]
for target in $game_troop .enemies
if target.exist ?
@target_battlers .push ( target)
end
end
end
end
end
# 应用通常攻击效果
for target in @target_battlers
target.attack_effect ( @active_battler)
end
return
end
# 防御的情况下
if @active_battler .current_action .basic == 1
# 帮助窗口显示"防御"
@help_window .set_text ( $data_system.words .guard , 1 )
return
end
# 逃跑的情况下
if @active_battler .is_a ?( Game_Enemy) and
@active_battler .current_action .basic == 2
# 帮助窗口显示"逃跑"
@help_window .set_text ( "逃跑" , 1 )
# 逃跑
@active_battler .escape
return
end
# 什么也不做的情况下
if @active_battler .current_action .basic == 3
# 清除强制行动对像的战斗者
$game_temp .forcing_battler = nil
# 移至步骤 1
@phase4_step = 1
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合步骤 6 : 刷新)
#--------------------------------------------------------------------------
def update_phase4_step6
# 清除强制行动对像的战斗者
$game_temp .forcing_battler = nil
# 公共事件 ID 有效的情况下
if @common_event_id > 0
# 设置事件
common_event = $data_common_events [ @common_event_id]
$game_system .battle_interpreter .setup ( common_event.list , 0 )
end
###为二次攻击者重新设置动作
if @active_battler .is_a ?( Game_Enemy)
@active_battler .make_action
end
# 移至步骤 1
@phase4_step = 1
end
end
#==============================================================================
# ■仿仙剑的群体攻击(鞭)、仙风云体步(仙女剑)以及敌人的双次攻击效果
#------------------------------------------------------------------------------
# 实现角色的攻击特点、武器的攻击特点、敌人的攻击特点 Ver 1.00
#==============================================================================
#用前须知
#首先请搞清楚,群攻是指林月如的鞭系那种攻击对方全体的普通攻击;
#仙风云体步是指赵灵儿用双剑攻击的每回合对同一敌人的两次普通攻击;
#在这个仿仙剑一的版本中,敌人的仙风云体步设置为双次攻击效果
#1.设置群体攻击的敌人,只需要在数据库敌人属性名字后面加后缀"@群攻"
#2.设置仙风云体步的敌人,需要在数据库敌人属性名字后面加后缀"@@仙风"注意是两个"@"
#3.如果一个敌人既是群攻又是仙风云体步,敌人属性名字后面加后缀"@群攻@仙风"
#4.设置群体攻击的武器,只需要在数据库武器属性名字后面加后缀"@群攻"
#5.设置仙风云体步的武器,需要在数据库敌人属性名字后面加后缀"@@仙风"同样注意是两个"@"
#6.如果一件武器既是群攻又是仙风云体术,武器属性名字后面加后缀"@群攻@仙风"
#7.如果有一个状态的效果是仙风云体术,请用下面的这个变量存储该状态的ID
Xianfengstate = 18
#--------------------------------------------------------------------------
# ● 去后缀处理
#--------------------------------------------------------------------------
class Window_Base < Window
def draw_item_name( item, x, y)
if item == nil
return
end
bitmap = RPG::Cache .icon ( item.icon_name )
self .contents .blt ( x, y + 4 , bitmap, Rect.new ( 0 , 0 , 24 , 24 ) )
self .contents .font .color = normal_color
self .contents .draw_text ( x + 28 , y, 212 , 32 , item.name .split ( "@" ) [ 0 ] )
end
end
class Game_Enemy < Game_Battler
def name
return $data_enemies [ @enemy_id] .name .split ( "@" ) [ 0 ]
end
def ifQungong
###如果要改变敌人群体攻击属性的后缀,改下面
return $data_enemies [ @enemy_id] .name .split ( "@" ) [ 1 ] == "群攻"
end
def ifXianfeng
###如果要改变敌人群体攻击属性的后缀,改下面
return $data_enemies [ @enemy_id] .name .split ( "@" ) [ 2 ] == "仙风"
end
end
#--------------------------------------------------------------------------
# ● 重写攻击情况下的脚本
#--------------------------------------------------------------------------
class Scene_Battle
#--------------------------------------------------------------------------
# ● 生成行动循序
#--------------------------------------------------------------------------
def make_action_orders
# 初始化序列 @action_battlers
@action_battlers = [ ]
# 添加敌人到 @action_battlers 序列
for enemy in $game_troop .enemies
@action_battlers .push ( enemy)
if enemy.ifXianfeng
@action_battlers .push ( enemy)
end
end
# 添加角色到 @action_battlers 序列
for actor in $game_party .actors
@action_battlers .push ( actor)
if ( actor.current_action .basic == 0 and actor.restriction == 0 and $data_weapons [ actor.weapon_id ] .name .split ( "@" ) [ 2 ] == "仙风" )
@action_battlers .push ( actor)
else
if actor.state ?( Xianfengstate)
@action_battlers .push ( actor)
end
end
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 make_basic_action_result
# 攻击的情况下
if @active_battler .current_action .basic == 0
# 设置攻击 ID
@animation1_id = @active_battler .animation1_id
@animation2_id = @active_battler .animation2_id
# 行动方的战斗者是敌人的情况下
if @active_battler .is_a ?( Game_Enemy)
if @active_battler .restriction == 3
target = $game_troop .random_target_enemy
elsif @active_battler .restriction == 2
target = $game_party .random_target_actor
else
index = @active_battler .current_action .target_index
target = $game_party .smooth_target_actor ( index)
end
end
# 行动方的战斗者是角色的情况下
if @active_battler .is_a ?( Game_Actor)
if @active_battler .restriction == 3
target = $game_party .random_target_actor
elsif @active_battler .restriction == 2
target = $game_troop .random_target_enemy
else
index = @active_battler .current_action .target_index
target = $game_troop .smooth_target_enemy ( index)
end
end
# 设置对像方的战斗者序列
@target_battlers = [ target]
# 如果敌人有“群攻”标记
if @active_battler .is_a ?( Game_Enemy)
if @active_battler .ifQungong
if @active_battler .restriction == 0
@target_battlers = [ ]
for target in $game_party .actors
if target.exist ?
@target_battlers .push ( target)
end
end
end
end
end
# 如果角色标有群攻或者武器含有“群攻”标记
if @active_battler .is_a ?( Game_Actor)
###如果要改变武器群体攻击属性的后缀,改下面
if $data_weapons [ @active_battler.weapon_id ] .name .split ( "@" ) [ 1 ] == "群攻"
if @active_battler .restriction == 0
@target_battlers = [ ]
for target in $game_troop .enemies
if target.exist ?
@target_battlers .push ( target)
end
end
end
end
end
# 应用通常攻击效果
for target in @target_battlers
target.attack_effect ( @active_battler)
end
return
end
# 防御的情况下
if @active_battler .current_action .basic == 1
# 帮助窗口显示"防御"
@help_window .set_text ( $data_system.words .guard , 1 )
return
end
# 逃跑的情况下
if @active_battler .is_a ?( Game_Enemy) and
@active_battler .current_action .basic == 2
# 帮助窗口显示"逃跑"
@help_window .set_text ( "逃跑" , 1 )
# 逃跑
@active_battler .escape
return
end
# 什么也不做的情况下
if @active_battler .current_action .basic == 3
# 清除强制行动对像的战斗者
$game_temp .forcing_battler = nil
# 移至步骤 1
@phase4_step = 1
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合步骤 6 : 刷新)
#--------------------------------------------------------------------------
def update_phase4_step6
# 清除强制行动对像的战斗者
$game_temp .forcing_battler = nil
# 公共事件 ID 有效的情况下
if @common_event_id > 0
# 设置事件
common_event = $data_common_events [ @common_event_id]
$game_system .battle_interpreter .setup ( common_event.list , 0 )
end
###为二次攻击者重新设置动作
if @active_battler .is_a ?( Game_Enemy)
@active_battler .make_action
end
# 移至步骤 1
@phase4_step = 1
end
end
作者: 芯☆淡茹水 时间: 2015-3-14 19:26
本帖最后由 芯☆淡茹水 于 2015-3-14 19:28 编辑
插入这个:#===========================================================================
module RPG
class Weapon
def name
return @name.split("@")[0] != nil ? @name.split("@")[0] : ""
end
end
end
#=========================================================================== 复制代码
作者: 龙和许也 时间: 2015-3-14 19:31
本帖最后由 龙和许也 于 2015-3-14 22:28 编辑
芯☆淡茹水 发表于 2015-3-14 19:26
插入这个:
啊……被你抢了,本来我是用这个笨方法的……
点开
请点开,你大致上看得懂我在改哪里吧?
作者: 芯☆淡茹水 时间: 2015-3-14 19:42
没功效?,那就换下面这个:#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
name = item.name.split("@")[0]
self.contents.draw_text(x + 28, y, 212, 32, name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end
#============================================================================== 复制代码
作者: 龙和许也 时间: 2015-3-14 20:02
芯☆淡茹水 发表于 2015-3-14 19:42
没功效?,那就换下面这个:
装备后会出现@,你试试看。
作者: qkqwe 时间: 2015-3-15 10:15
芯☆淡茹水 发表于 2015-3-14 19:42
没功效?,那就换下面这个:
貌似还是有问题,在物品栏里还是会显示@后的字样
作者: 芯☆淡茹水 时间: 2015-3-15 10:21
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name.split("@")[0], 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
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 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
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, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name.split("@")[0], 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end
#============================================================================== 复制代码
作者: qkqwe 时间: 2015-3-15 18:19
芯☆淡茹水 发表于 2015-3-15 10:21
谢谢大神,用了脚本后的确装备区内@后的字样不见了,不过还是出现了俩个问题,如下面俩图1)下方红框装备处发生错位,只显示一个可装备的名称,其余的都错位到后方而不再显示于下方;2)装备区的@字样不见了,但在物品栏内查看装备时依然带有@字样。
作者: qkqwe 时间: 2015-3-17 12:01
qkqwe 发表于 2015-3-15 18:19
谢谢大神,用了脚本后的确装备区内@后的字样不见了,不过还是出现了俩个问题,如下面俩图1)下方红框装备 ...
抱歉,大神,附上物品分类和装备界面脚本
物品分类:
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
#==============================================================================
# ■ Harts_Window_ItemTitle
#------------------------------------------------------------------------------
# アイテム画面で、タイトルを表示するウィンドウ。
#==============================================================================
class Harts_Window_ItemTitle < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super ( 0 , 0 , 160 , 64 )
self .contents = Bitmap.new ( width - 32 , height - 32 )
self .contents .clear
self .contents .font .color = normal_color
self .contents .draw_text ( 4 , 0 , 120 , 32 , $data_system .words .item , 1 )
end
end
#==============================================================================
# ■ Harts_Window_ItemCommand
#------------------------------------------------------------------------------
# アイテムの種別選択を行うウィンドウです。
#==============================================================================
class Harts_Window_ItemCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super ( 0 , 64 , 160 , 288 )
self .contents = Bitmap.new ( width - 32 , height - 32 )
@item_max = 8
@commands = [ "一般用" , "战斗用" , $data_system .words .weapon , $data_system .words .armor1 , $data_system .words .armor2 , $data_system .words .armor3 , $data_system .words .armor4 , "特殊道具" ]
refresh
self .index = 0
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self .contents .clear
for i in 0 ...@item_max
draw_item( i, normal_color)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item( index, color)
self .contents .font .color = color
y = index * 32
self .contents .draw_text ( 4 , y, 128 , 32 , @commands [ index] )
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
case self .index
when 0
@text = @commands [ 0 ]
when 1
@text = @commands [ 1 ]
when 2
@text = @commands [ 2 ]
when 3
@text = @commands [ 3 ]
when 4
@text = @commands [ 4 ]
when 5
@text = @commands [ 5 ]
when 6
@text = @commands [ 6 ]
when 7
@text = @commands [ 7 ]
end
@help_window .set_text ( @text)
end
end
#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
# アイテム画面で、所持アイテムの一覧を表示するウィンドウです。
#==============================================================================
class Harts_Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super ( 160 , 0 , 480 , 416 )
refresh
self .index = 0
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data [ self .index ]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self .contents != nil
self .contents .dispose
self .contents = nil
end
@data = [ ]
end
#--------------------------------------------------------------------------
# ● アイテム一覧設定
# command : 選択中のコマンド
#--------------------------------------------------------------------------
def set_item( command)
refresh
case command
when 0
for i in 1 ...$data_items.size
if ( $data_items[ i] .occasion == 0 or $data_items [ i] .occasion == 2 ) and $game_party .item_number ( i) > 0
@data .push ( $data_items[ i] )
end
end
when 1
for i in 1 ...$data_items.size
if ( $data_items[ i] .occasion == 1 and $game_party .item_number ( i) > 0 )
@data .push ( $data_items[ i] )
end
end
when 2
for i in 1 ...$data_weapons.size
if $game_party .weapon_number ( i) > 0
@data .push ( $data_weapons[ i] )
end
end
when 3
for i in 1 ...$data_armors.size
if $data_armors [ i] .kind == 0 and $game_party .armor_number ( i) > 0
@data .push ( $data_armors[ i] )
end
end
when 4
for i in 1 ...$data_armors.size
if $data_armors [ i] .kind == 1 and $game_party .armor_number ( i) > 0
@data .push ( $data_armors[ i] )
end
end
when 5
for i in 1 ...$data_armors.size
if $data_armors [ i] .kind == 2 and $game_party .armor_number ( i) > 0
@data .push ( $data_armors[ i] )
end
end
when 6
for i in 1 ...$data_armors.size
if $data_armors [ i] .kind == 3 and $game_party .armor_number ( i) > 0
@data .push ( $data_armors[ i] )
end
end
when 7
for i in 1 ...$data_items.size
if $data_items [ i] .occasion == 3 and $game_party .item_number ( i) > 0
@data .push ( $data_items[ i] )
end
end
end
# 項目数が 0 でなければビットマップを作成し、全項目を描画
@item_max = @data .size
if @item_max > 0
self .contents = Bitmap.new ( width - 32 , row_max * 32 )
self .contents .clear
for i in 0 ...@item_max
draw_item( i)
end
end
end
#--------------------------------------------------------------------------
# ● 種類別アイテム数の取得
#--------------------------------------------------------------------------
def item_number
return @item_max
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
y = index * 32
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 , 24 , 24 ) , opacity)
self .contents .draw_text ( x + 28 , y, 212 , 32 , item.name , 0 )
self .contents .draw_text ( x + 400 , y, 16 , 32 , ":" , 1 )
self .contents .draw_text ( x + 416 , y, 24 , 32 , number.to_s , 2 )
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window .set_text ( self .item == nil ? "" : self .item .description )
end
end
#==============================================================================
# ■ Harts_Scene_Item
#------------------------------------------------------------------------------
# アイテム画面の処理を行うクラスです。再定義
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# タイトルウィンドウを作成
@itemtitle_window = Harts_Window_ItemTitle.new
#コマンドウィンドウを作成
@itemcommand_window = Harts_Window_ItemCommand.new
@command_index = @itemcommand_window .index
#アイテムウィンドウを作成
@itemlist_window = Harts_Window_ItemList.new
@itemlist_window .active = false
#ヘルプウィンドウを作成
@help_window = Window_Help.new
@help_window .x = 0
@help_window .y = 416
# ヘルプウィンドウを関連付け
@itemcommand_window .help_window = @help_window
@itemlist_window .help_window = @help_window
# ターゲットウィンドウを作成 (不可視?非アクティブに設定)
@target_window = Window_Target.new
@target_window .visible = false
@target_window .active = false
# アイテムウィンドウ内容表示
@itemlist_window .set_item ( @command_index)
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@itemtitle_window .dispose
@itemcommand_window .dispose
@itemlist_window .dispose
@help_window .dispose
@target_window .dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@itemtitle_window .update
@itemcommand_window .update
@itemlist_window .update
@help_window .update
@target_window .update
if @command_index != @itemcommand_window .index
@command_index = @itemcommand_window .index
@itemlist_window .set_item ( @command_index)
end
# コマンドウィンドウがアクティブの場合: update_itemcommand を呼ぶ
if @itemcommand_window .active
update_itemcommand
return
end
# アイテムウィンドウがアクティブの場合: update_itemlist を呼ぶ
if @itemlist_window .active
update_itemlist
return
end
# ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
if @target_window .active
update_target
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (コマンドウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_itemcommand
# B ボタンが押された場合
if Input.trigger ?( Input::B )
# キャンセル SE を演奏
$game_system .se_play ( $data_system.cancel_se )
# メニュー画面に切り替え
$scene = Scene_Menu.new ( 0 )
return
end
# C ボタンが押された場合
if Input.trigger ?( Input::C )
# 選択中のコマンドのアイテムがない場合
if @itemlist_window .item_number == 0
# ブザー SE を演奏
$game_system .se_play ( $data_system.buzzer_se )
return
end
# 決定 SE を演奏
$game_system .se_play ( $data_system.decision_se )
# アイテムウィンドウをアクティブにする
@itemcommand_window .active = false
@itemlist_window .active = true
@itemlist_window .index = 0
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アイテムウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_itemlist
# B ボタンが押された場合
if Input.trigger ?( Input::B )
# キャンセル SE を演奏
$game_system .se_play ( $data_system.cancel_se )
# アイテムウィンドウをアクティブにする
@itemcommand_window .active = true
@itemlist_window .active = false
@itemlist_window .index = 0
@itemcommand_window .index = @command_index
return
end
# C ボタンが押された場合
if Input.trigger ?( Input::C )
# アイテムウィンドウで現在選択されているデータを取得
@item = @itemlist_window .item
# 使用アイテムではない場合
unless @item .is_a ?( RPG::Item )
# ブザー SE を演奏
$game_system .se_play ( $data_system.buzzer_se )
return
end
# 使用できない場合
unless $game_party .item_can_use ?( @item.id )
# ブザー SE を演奏
$game_system .se_play ( $data_system.buzzer_se )
return
end
# 決定 SE を演奏
$game_system .se_play ( $data_system.decision_se )
# 効果範囲が味方の場合
if @item .scope >= 3
# ターゲットウィンドウをアクティブ化
@itemlist_window .active = false
@target_window .x = 304
@target_window .visible = true
@target_window .active = true
# 効果範囲 (単体/全体) に応じてカーソル位置を設定
if @item .scope == 4 || @item .scope == 6
@target_window .index = -1
else
@target_window .index = 0
end
# 効果範囲が味方以外の場合
else
# コモンイベント ID が有効の場合
if @item .common_event_id > 0
# コモンイベント呼び出し予約
$game_temp .common_event_id = @item .common_event_id
# アイテムの使用時 SE を演奏
$game_system .se_play ( @item.menu_se )
# 消耗品の場合
if @item .consumable
# 使用したアイテムを 1 減らす
$game_party .lose_item ( @item.id , 1 )
# アイテムウィンドウの項目を再描画
@itemlist_window .draw_item ( @itemlist_window.index )
end
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
end
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_target
# B ボタンが押された場合
if Input.trigger ?( Input::B )
# キャンセル SE を演奏
$game_system .se_play ( $data_system.cancel_se )
# アイテム切れなどで使用できなくなった場合
unless $game_party .item_can_use ?( @item.id )
# アイテムウィンドウの内容を再作成
@itemlist_window .refresh
end
# ターゲットウィンドウを消去
@itemlist_window .active = true
@target_window .visible = false
@target_window .active = false
@itemlist_window .set_item ( @command_index)
return
end
# C ボタンが押された場合
if Input.trigger ?( Input::C )
# アイテムを使い切った場合
if $game_party .item_number ( @item.id ) == 0
# ブザー SE を演奏
$game_system .se_play ( $data_system.buzzer_se )
return
end
# ターゲットが全体の場合
if @target_window .index == -1
# パーティ全体にアイテムの使用効果を適用
used = false
for i in $game_party .actors
used |= i.item_effect ( @item)
end
end
# ターゲットが単体の場合
if @target_window .index >= 0
# ターゲットのアクターにアイテムの使用効果を適用
target = $game_party .actors [ @target_window.index ]
used = target.item_effect ( @item)
end
# アイテムを使った場合
if used
# アイテムの使用時 SE を演奏
$game_system .se_play ( @item.menu_se )
# 消耗品の場合
if @item .consumable
# 使用したアイテムを 1 減らす
$game_party .lose_item ( @item.id , 1 )
# アイテムウィンドウの項目を再描画
@itemlist_window .draw_item ( @itemlist_window.index )
@itemlist_window .set_item ( @command_index)
end
# ターゲットウィンドウの内容を再作成
@target_window .refresh
# 全滅の場合
if $game_party .all_dead ?
# ゲームオーバー画面に切り替え
$scene = Scene_Gameover.new
return
end
# コモンイベント ID が有効の場合
if @item .common_event_id > 0
# コモンイベント呼び出し予約
$game_temp .common_event_id = @item .common_event_id
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
end
# アイテムを使わなかった場合
unless used
# ブザー SE を演奏
$game_system .se_play ( $data_system.buzzer_se )
end
return
end
end
end
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
#==============================================================================
# ■ Harts_Window_ItemTitle
#------------------------------------------------------------------------------
# アイテム画面で、タイトルを表示するウィンドウ。
#==============================================================================
class Harts_Window_ItemTitle < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super ( 0 , 0 , 160 , 64 )
self .contents = Bitmap.new ( width - 32 , height - 32 )
self .contents .clear
self .contents .font .color = normal_color
self .contents .draw_text ( 4 , 0 , 120 , 32 , $data_system .words .item , 1 )
end
end
#==============================================================================
# ■ Harts_Window_ItemCommand
#------------------------------------------------------------------------------
# アイテムの種別選択を行うウィンドウです。
#==============================================================================
class Harts_Window_ItemCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super ( 0 , 64 , 160 , 288 )
self .contents = Bitmap.new ( width - 32 , height - 32 )
@item_max = 8
@commands = [ "一般用" , "战斗用" , $data_system .words .weapon , $data_system .words .armor1 , $data_system .words .armor2 , $data_system .words .armor3 , $data_system .words .armor4 , "特殊道具" ]
refresh
self .index = 0
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self .contents .clear
for i in 0 ...@item_max
draw_item( i, normal_color)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item( index, color)
self .contents .font .color = color
y = index * 32
self .contents .draw_text ( 4 , y, 128 , 32 , @commands [ index] )
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
case self .index
when 0
@text = @commands [ 0 ]
when 1
@text = @commands [ 1 ]
when 2
@text = @commands [ 2 ]
when 3
@text = @commands [ 3 ]
when 4
@text = @commands [ 4 ]
when 5
@text = @commands [ 5 ]
when 6
@text = @commands [ 6 ]
when 7
@text = @commands [ 7 ]
end
@help_window .set_text ( @text)
end
end
#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
# アイテム画面で、所持アイテムの一覧を表示するウィンドウです。
#==============================================================================
class Harts_Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super ( 160 , 0 , 480 , 416 )
refresh
self .index = 0
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data [ self .index ]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self .contents != nil
self .contents .dispose
self .contents = nil
end
@data = [ ]
end
#--------------------------------------------------------------------------
# ● アイテム一覧設定
# command : 選択中のコマンド
#--------------------------------------------------------------------------
def set_item( command)
refresh
case command
when 0
for i in 1 ...$data_items.size
if ( $data_items[ i] .occasion == 0 or $data_items [ i] .occasion == 2 ) and $game_party .item_number ( i) > 0
@data .push ( $data_items[ i] )
end
end
when 1
for i in 1 ...$data_items.size
if ( $data_items[ i] .occasion == 1 and $game_party .item_number ( i) > 0 )
@data .push ( $data_items[ i] )
end
end
when 2
for i in 1 ...$data_weapons.size
if $game_party .weapon_number ( i) > 0
@data .push ( $data_weapons[ i] )
end
end
when 3
for i in 1 ...$data_armors.size
if $data_armors [ i] .kind == 0 and $game_party .armor_number ( i) > 0
@data .push ( $data_armors[ i] )
end
end
when 4
for i in 1 ...$data_armors.size
if $data_armors [ i] .kind == 1 and $game_party .armor_number ( i) > 0
@data .push ( $data_armors[ i] )
end
end
when 5
for i in 1 ...$data_armors.size
if $data_armors [ i] .kind == 2 and $game_party .armor_number ( i) > 0
@data .push ( $data_armors[ i] )
end
end
when 6
for i in 1 ...$data_armors.size
if $data_armors [ i] .kind == 3 and $game_party .armor_number ( i) > 0
@data .push ( $data_armors[ i] )
end
end
when 7
for i in 1 ...$data_items.size
if $data_items [ i] .occasion == 3 and $game_party .item_number ( i) > 0
@data .push ( $data_items[ i] )
end
end
end
# 項目数が 0 でなければビットマップを作成し、全項目を描画
@item_max = @data .size
if @item_max > 0
self .contents = Bitmap.new ( width - 32 , row_max * 32 )
self .contents .clear
for i in 0 ...@item_max
draw_item( i)
end
end
end
#--------------------------------------------------------------------------
# ● 種類別アイテム数の取得
#--------------------------------------------------------------------------
def item_number
return @item_max
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
y = index * 32
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 , 24 , 24 ) , opacity)
self .contents .draw_text ( x + 28 , y, 212 , 32 , item.name , 0 )
self .contents .draw_text ( x + 400 , y, 16 , 32 , ":" , 1 )
self .contents .draw_text ( x + 416 , y, 24 , 32 , number.to_s , 2 )
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window .set_text ( self .item == nil ? "" : self .item .description )
end
end
#==============================================================================
# ■ Harts_Scene_Item
#------------------------------------------------------------------------------
# アイテム画面の処理を行うクラスです。再定義
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# タイトルウィンドウを作成
@itemtitle_window = Harts_Window_ItemTitle.new
#コマンドウィンドウを作成
@itemcommand_window = Harts_Window_ItemCommand.new
@command_index = @itemcommand_window .index
#アイテムウィンドウを作成
@itemlist_window = Harts_Window_ItemList.new
@itemlist_window .active = false
#ヘルプウィンドウを作成
@help_window = Window_Help.new
@help_window .x = 0
@help_window .y = 416
# ヘルプウィンドウを関連付け
@itemcommand_window .help_window = @help_window
@itemlist_window .help_window = @help_window
# ターゲットウィンドウを作成 (不可視?非アクティブに設定)
@target_window = Window_Target.new
@target_window .visible = false
@target_window .active = false
# アイテムウィンドウ内容表示
@itemlist_window .set_item ( @command_index)
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@itemtitle_window .dispose
@itemcommand_window .dispose
@itemlist_window .dispose
@help_window .dispose
@target_window .dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@itemtitle_window .update
@itemcommand_window .update
@itemlist_window .update
@help_window .update
@target_window .update
if @command_index != @itemcommand_window .index
@command_index = @itemcommand_window .index
@itemlist_window .set_item ( @command_index)
end
# コマンドウィンドウがアクティブの場合: update_itemcommand を呼ぶ
if @itemcommand_window .active
update_itemcommand
return
end
# アイテムウィンドウがアクティブの場合: update_itemlist を呼ぶ
if @itemlist_window .active
update_itemlist
return
end
# ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
if @target_window .active
update_target
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (コマンドウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_itemcommand
# B ボタンが押された場合
if Input.trigger ?( Input::B )
# キャンセル SE を演奏
$game_system .se_play ( $data_system.cancel_se )
# メニュー画面に切り替え
$scene = Scene_Menu.new ( 0 )
return
end
# C ボタンが押された場合
if Input.trigger ?( Input::C )
# 選択中のコマンドのアイテムがない場合
if @itemlist_window .item_number == 0
# ブザー SE を演奏
$game_system .se_play ( $data_system.buzzer_se )
return
end
# 決定 SE を演奏
$game_system .se_play ( $data_system.decision_se )
# アイテムウィンドウをアクティブにする
@itemcommand_window .active = false
@itemlist_window .active = true
@itemlist_window .index = 0
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アイテムウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_itemlist
# B ボタンが押された場合
if Input.trigger ?( Input::B )
# キャンセル SE を演奏
$game_system .se_play ( $data_system.cancel_se )
# アイテムウィンドウをアクティブにする
@itemcommand_window .active = true
@itemlist_window .active = false
@itemlist_window .index = 0
@itemcommand_window .index = @command_index
return
end
# C ボタンが押された場合
if Input.trigger ?( Input::C )
# アイテムウィンドウで現在選択されているデータを取得
@item = @itemlist_window .item
# 使用アイテムではない場合
unless @item .is_a ?( RPG::Item )
# ブザー SE を演奏
$game_system .se_play ( $data_system.buzzer_se )
return
end
# 使用できない場合
unless $game_party .item_can_use ?( @item.id )
# ブザー SE を演奏
$game_system .se_play ( $data_system.buzzer_se )
return
end
# 決定 SE を演奏
$game_system .se_play ( $data_system.decision_se )
# 効果範囲が味方の場合
if @item .scope >= 3
# ターゲットウィンドウをアクティブ化
@itemlist_window .active = false
@target_window .x = 304
@target_window .visible = true
@target_window .active = true
# 効果範囲 (単体/全体) に応じてカーソル位置を設定
if @item .scope == 4 || @item .scope == 6
@target_window .index = -1
else
@target_window .index = 0
end
# 効果範囲が味方以外の場合
else
# コモンイベント ID が有効の場合
if @item .common_event_id > 0
# コモンイベント呼び出し予約
$game_temp .common_event_id = @item .common_event_id
# アイテムの使用時 SE を演奏
$game_system .se_play ( @item.menu_se )
# 消耗品の場合
if @item .consumable
# 使用したアイテムを 1 減らす
$game_party .lose_item ( @item.id , 1 )
# アイテムウィンドウの項目を再描画
@itemlist_window .draw_item ( @itemlist_window.index )
end
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
end
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_target
# B ボタンが押された場合
if Input.trigger ?( Input::B )
# キャンセル SE を演奏
$game_system .se_play ( $data_system.cancel_se )
# アイテム切れなどで使用できなくなった場合
unless $game_party .item_can_use ?( @item.id )
# アイテムウィンドウの内容を再作成
@itemlist_window .refresh
end
# ターゲットウィンドウを消去
@itemlist_window .active = true
@target_window .visible = false
@target_window .active = false
@itemlist_window .set_item ( @command_index)
return
end
# C ボタンが押された場合
if Input.trigger ?( Input::C )
# アイテムを使い切った場合
if $game_party .item_number ( @item.id ) == 0
# ブザー SE を演奏
$game_system .se_play ( $data_system.buzzer_se )
return
end
# ターゲットが全体の場合
if @target_window .index == -1
# パーティ全体にアイテムの使用効果を適用
used = false
for i in $game_party .actors
used |= i.item_effect ( @item)
end
end
# ターゲットが単体の場合
if @target_window .index >= 0
# ターゲットのアクターにアイテムの使用効果を適用
target = $game_party .actors [ @target_window.index ]
used = target.item_effect ( @item)
end
# アイテムを使った場合
if used
# アイテムの使用時 SE を演奏
$game_system .se_play ( @item.menu_se )
# 消耗品の場合
if @item .consumable
# 使用したアイテムを 1 減らす
$game_party .lose_item ( @item.id , 1 )
# アイテムウィンドウの項目を再描画
@itemlist_window .draw_item ( @itemlist_window.index )
@itemlist_window .set_item ( @command_index)
end
# ターゲットウィンドウの内容を再作成
@target_window .refresh
# 全滅の場合
if $game_party .all_dead ?
# ゲームオーバー画面に切り替え
$scene = Scene_Gameover.new
return
end
# コモンイベント ID が有効の場合
if @item .common_event_id > 0
# コモンイベント呼び出し予約
$game_temp .common_event_id = @item .common_event_id
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
end
# アイテムを使わなかった場合
unless used
# ブザー SE を演奏
$game_system .se_play ( $data_system.buzzer_se )
end
return
end
end
end
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
装备界面:
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# 游戏中全部窗口的超级类。
#==============================================================================
class Window_Base < Window
def up_color
return Color.new ( 255 , 0 , 0 )
end
def down_color
return Color.new ( 0 , 255 , 0 )
end
#--------------------------------------------------------------------------
# ● 描绘能力值
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# type : 能力值种类 (0~6)
#--------------------------------------------------------------------------
def draw_actor_parameter( actor, x, y, type)
case type
when 0
parameter_name = $data_system .words .atk
parameter_value = actor.atk
when 1
parameter_name = $data_system .words .pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system .words .mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system .words .str
parameter_value = actor.str
when 4
parameter_name = $data_system .words .dex
parameter_value = actor.dex
when 5
parameter_name = $data_system .words .agi
parameter_value = actor.agi
when 6
parameter_name = $data_system .words .int
parameter_value = actor.int
###############################################################
when 7
parameter_name = "回避"
parameter_value = actor.eva
end
self .contents .font .color = system_color
self .contents .draw_text ( x, y, 120 , 32 , parameter_name)
self .contents .font .color = normal_color
self .contents .draw_text ( x + 120 , y, 36 , 32 , parameter_value.to_s , 2 )
end
end
#==============================================================================
# ■ Window_EquipLeft
#------------------------------------------------------------------------------
# 装备画面的、显示角色能力值变化的窗口。
#==============================================================================
class Window_EquipLeft < Window_Base
UP_ICON = "048-Skill05"
DOWN_ICON = "047-Skill04"
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize( actor)
super ( 0 , 64 , 272 , 416 )
self .contents = Bitmap.new ( width - 32 , height - 32 )
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self .contents .clear
draw_actor_name( @actor, 4 , 0 )
draw_actor_level( @actor, 4 , 32 )
###############################################################
draw_actor_parameter( @actor, 4 , 64 , 0 )
draw_actor_parameter( @actor, 4 , 96 , 1 )
draw_actor_parameter( @actor, 4 , 128 , 2 )
draw_actor_parameter( @actor, 4 , 160 , 7 )
draw_actor_parameter( @actor, 4 , 192 , 3 )
draw_actor_parameter( @actor, 4 , 224 , 4 )
draw_actor_parameter( @actor, 4 , 256 , 5 )
draw_actor_parameter( @actor, 4 , 288 , 6 )
if @new_atk != nil
if @new_atk > @actor .atk
self .contents .blt ( 164 , 64 , RPG::Cache .icon ( UP_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
elsif @new_atk < @actor .atk
self .contents .blt ( 164 , 64 , RPG::Cache .icon ( DOWN_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
end
self .contents .font .color = @new_atk >@actor.atk ? up_color : down_color
self .contents .font .color = normal_color if @new_atk == @actor .atk
self .contents .draw_text ( 200 , 64 , 36 , 32 , @new_atk .to_s , 2 )
end
if @new_pdef != nil
if @new_pdef > @actor .pdef
self .contents .blt ( 164 , 96 , RPG::Cache .icon ( UP_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
elsif @new_pdef < @actor .pdef
self .contents .blt ( 164 , 96 , RPG::Cache .icon ( DOWN_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
end
self .contents .font .color = @new_pdef >@actor.pdef ? up_color : down_color
self .contents .font .color = normal_color if @new_pdef == @actor .pdef
self .contents .draw_text ( 200 , 96 , 36 , 32 , @new_pdef .to_s , 2 )
end
if @new_mdef != nil
if @new_mdef > @actor .mdef
self .contents .blt ( 164 , 128 , RPG::Cache .icon ( UP_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
elsif @new_mdef < @actor .mdef
self .contents .blt ( 164 , 128 , RPG::Cache .icon ( DOWN_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
end
self .contents .font .color = @new_mdef >@actor.mdef ? up_color : down_color
self .contents .font .color = normal_color if @new_mdef == @actor .mdef
self .contents .draw_text ( 200 , 128 , 36 , 32 , @new_mdef .to_s , 2 )
end
if @new_eva != nil
if @new_eva > @actor .eva
self .contents .blt ( 164 , 160 , RPG::Cache .icon ( UP_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
elsif @new_eva < @actor .eva
self .contents .blt ( 164 , 160 , RPG::Cache .icon ( DOWN_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
end
self .contents .font .color = @new_eva >@actor.eva ? up_color : down_color
self .contents .font .color = normal_color if @new_eva == @actor .eva
self .contents .draw_text ( 200 , 160 , 36 , 32 , @new_eva .to_s , 2 )
end
if @new_str != nil
if @new_str > @actor .str
self .contents .blt ( 164 , 192 , RPG::Cache .icon ( UP_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
elsif @new_str < @actor .str
self .contents .blt ( 164 , 192 , RPG::Cache .icon ( DOWN_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
end
self .contents .font .color = @new_str >@actor.str ? up_color : down_color
self .contents .font .color = normal_color if @new_str == @actor .str
self .contents .draw_text ( 200 , 192 , 36 , 32 , @new_str .to_s , 2 )
end
if @new_dex != nil
if @new_dex > @actor .dex
self .contents .blt ( 164 , 224 , RPG::Cache .icon ( UP_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
elsif @new_dex < @actor .dex
self .contents .blt ( 164 , 224 , RPG::Cache .icon ( DOWN_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
end
self .contents .font .color = @new_dex >@actor.dex ? up_color : down_color
self .contents .font .color = normal_color if @new_dex == @actor .dex
self .contents .draw_text ( 200 , 224 , 36 , 32 , @new_dex .to_s , 2 )
end
if @new_agi != nil
if @new_agi > @actor .agi
self .contents .blt ( 164 , 256 , RPG::Cache .icon ( UP_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
elsif @new_agi < @actor .agi
self .contents .blt ( 164 , 256 , RPG::Cache .icon ( DOWN_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
end
self .contents .font .color = @new_agi >@actor.agi ? up_color : down_color
self .contents .font .color = normal_color if @new_agi == @actor .agi
self .contents .draw_text ( 200 , 256 , 36 , 32 , @new_agi .to_s , 2 )
end
if @new_int != nil
if @new_int > @actor .int
self .contents .blt ( 164 , 288 , RPG::Cache .icon ( UP_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
elsif @new_int < @actor .int
self .contents .blt ( 164 , 288 , RPG::Cache .icon ( DOWN_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
end
self .contents .font .color = @new_int >@actor.int ? up_color : down_color
self .contents .font .color = normal_color if @new_int == @actor .int
self .contents .draw_text ( 200 , 288 , 36 , 32 , @new_int .to_s , 2 )
end
end
#--------------------------------------------------------------------------
# ● 变更装备后的能力值设置
# new_atk : 变更装备后的攻击力
# new_pdef : 变更装备后的物理防御
# new_mdef : 变更装备后的魔法防御
#--------------------------------------------------------------------------
###############################################################
def set_new_parameters( new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
if @new_atk != new_atk or @new_pdef !=new_pdef or @new_mdef != new_mdef or @new_eva != new_eva or @new_str != new_str or @new_dex !=new_dex or @new_agi != new_agi or @new_int != new_int
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_eva = new_eva
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
refresh
end
end
end
#==============================================================================
# ■ Window_EquipItem
#------------------------------------------------------------------------------
# 装备画面、显示浏览变更装备的候补物品的窗口。
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
# equip_type : 装备部位 (0~3)
#--------------------------------------------------------------------------
def initialize( actor, equip_type)
################改了改坐标和高度#################################
super ( 272 , 256 , 368 , 224 )
@actor = actor
@equip_type = equip_type
@column_max = 1
refresh
self .active = false
self .index = -1
end
#--------------------------------------------------------------------------
# ● 项目的描绘
# index : 项目符号
#--------------------------------------------------------------------------
def draw_item( index)
item = @data [ index]
################改了改坐标#################################
x = 4
y = index * 32
case item
when RPG::Weapon
number = $game_party .weapon_number ( item.id )
when RPG::Armor
number = $game_party .armor_number ( item.id )
end
bitmap = RPG::Cache .icon ( item.icon_name )
self .contents .blt ( x, y + 4 , bitmap, Rect.new ( 0 , 0 , 24 , 24 ) )
self .contents .font .color = normal_color
self .contents .draw_text ( x + 28 , y, 212 , 32 , item.name , 0 )
self .contents .draw_text ( x + 240 , y, 16 , 32 , ":" , 1 )
self .contents .draw_text ( x + 256 , y, 24 , 32 , number.to_s , 2 )
end
end
#==============================================================================
# ■ Scene_Equip
#------------------------------------------------------------------------------
# 处理装备画面的类。
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
# 设置物品窗口的可视状态
@item_window1 .visible = ( @right_window.index == 0 )
@item_window2 .visible = ( @right_window.index == 1 )
@item_window3 .visible = ( @right_window.index == 2 )
@item_window4 .visible = ( @right_window.index == 3 )
@item_window5 .visible = ( @right_window.index == 4 )
# 获取当前装备中的物品
item1 = @right_window .item
# 设置当前的物品窗口到 @item_window
case @right_window .index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end
# 右窗口被激活的情况下
if @right_window .active
# 删除变更装备后的能力
###############################################################
@left_window .set_new_parameters ( nil , nil , nil , nil , nil , nil , nil , nil )
end
# 物品窗口被激活的情况下
if @item_window .active
# 获取现在选中的物品
item2 = @item_window .item
# 变更装备
last_hp = @actor .hp
last_sp = @actor .sp
@actor .equip ( @right_window.index , item2 == nil ? 0 : item2.id )
# 获取变更装备后的能力值
###############################################################
new_atk = @actor .atk
new_pdef = @actor .pdef
new_mdef = @actor .mdef
new_eva = @actor .eva
new_str = @actor .str
new_dex = @actor .dex
new_agi = @actor .agi
new_int = @actor .int
# 返回到装备
@actor .equip ( @right_window.index , item1 == nil ? 0 : item1.id )
@actor .hp = last_hp
@actor .sp = last_sp
# 描画左窗口
###############################################################
@left_window .set_new_parameters ( new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
end
end
end
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# 游戏中全部窗口的超级类。
#==============================================================================
class Window_Base < Window
def up_color
return Color.new ( 255 , 0 , 0 )
end
def down_color
return Color.new ( 0 , 255 , 0 )
end
#--------------------------------------------------------------------------
# ● 描绘能力值
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# type : 能力值种类 (0~6)
#--------------------------------------------------------------------------
def draw_actor_parameter( actor, x, y, type)
case type
when 0
parameter_name = $data_system .words .atk
parameter_value = actor.atk
when 1
parameter_name = $data_system .words .pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system .words .mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system .words .str
parameter_value = actor.str
when 4
parameter_name = $data_system .words .dex
parameter_value = actor.dex
when 5
parameter_name = $data_system .words .agi
parameter_value = actor.agi
when 6
parameter_name = $data_system .words .int
parameter_value = actor.int
###############################################################
when 7
parameter_name = "回避"
parameter_value = actor.eva
end
self .contents .font .color = system_color
self .contents .draw_text ( x, y, 120 , 32 , parameter_name)
self .contents .font .color = normal_color
self .contents .draw_text ( x + 120 , y, 36 , 32 , parameter_value.to_s , 2 )
end
end
#==============================================================================
# ■ Window_EquipLeft
#------------------------------------------------------------------------------
# 装备画面的、显示角色能力值变化的窗口。
#==============================================================================
class Window_EquipLeft < Window_Base
UP_ICON = "048-Skill05"
DOWN_ICON = "047-Skill04"
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize( actor)
super ( 0 , 64 , 272 , 416 )
self .contents = Bitmap.new ( width - 32 , height - 32 )
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self .contents .clear
draw_actor_name( @actor, 4 , 0 )
draw_actor_level( @actor, 4 , 32 )
###############################################################
draw_actor_parameter( @actor, 4 , 64 , 0 )
draw_actor_parameter( @actor, 4 , 96 , 1 )
draw_actor_parameter( @actor, 4 , 128 , 2 )
draw_actor_parameter( @actor, 4 , 160 , 7 )
draw_actor_parameter( @actor, 4 , 192 , 3 )
draw_actor_parameter( @actor, 4 , 224 , 4 )
draw_actor_parameter( @actor, 4 , 256 , 5 )
draw_actor_parameter( @actor, 4 , 288 , 6 )
if @new_atk != nil
if @new_atk > @actor .atk
self .contents .blt ( 164 , 64 , RPG::Cache .icon ( UP_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
elsif @new_atk < @actor .atk
self .contents .blt ( 164 , 64 , RPG::Cache .icon ( DOWN_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
end
self .contents .font .color = @new_atk >@actor.atk ? up_color : down_color
self .contents .font .color = normal_color if @new_atk == @actor .atk
self .contents .draw_text ( 200 , 64 , 36 , 32 , @new_atk .to_s , 2 )
end
if @new_pdef != nil
if @new_pdef > @actor .pdef
self .contents .blt ( 164 , 96 , RPG::Cache .icon ( UP_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
elsif @new_pdef < @actor .pdef
self .contents .blt ( 164 , 96 , RPG::Cache .icon ( DOWN_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
end
self .contents .font .color = @new_pdef >@actor.pdef ? up_color : down_color
self .contents .font .color = normal_color if @new_pdef == @actor .pdef
self .contents .draw_text ( 200 , 96 , 36 , 32 , @new_pdef .to_s , 2 )
end
if @new_mdef != nil
if @new_mdef > @actor .mdef
self .contents .blt ( 164 , 128 , RPG::Cache .icon ( UP_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
elsif @new_mdef < @actor .mdef
self .contents .blt ( 164 , 128 , RPG::Cache .icon ( DOWN_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
end
self .contents .font .color = @new_mdef >@actor.mdef ? up_color : down_color
self .contents .font .color = normal_color if @new_mdef == @actor .mdef
self .contents .draw_text ( 200 , 128 , 36 , 32 , @new_mdef .to_s , 2 )
end
if @new_eva != nil
if @new_eva > @actor .eva
self .contents .blt ( 164 , 160 , RPG::Cache .icon ( UP_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
elsif @new_eva < @actor .eva
self .contents .blt ( 164 , 160 , RPG::Cache .icon ( DOWN_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
end
self .contents .font .color = @new_eva >@actor.eva ? up_color : down_color
self .contents .font .color = normal_color if @new_eva == @actor .eva
self .contents .draw_text ( 200 , 160 , 36 , 32 , @new_eva .to_s , 2 )
end
if @new_str != nil
if @new_str > @actor .str
self .contents .blt ( 164 , 192 , RPG::Cache .icon ( UP_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
elsif @new_str < @actor .str
self .contents .blt ( 164 , 192 , RPG::Cache .icon ( DOWN_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
end
self .contents .font .color = @new_str >@actor.str ? up_color : down_color
self .contents .font .color = normal_color if @new_str == @actor .str
self .contents .draw_text ( 200 , 192 , 36 , 32 , @new_str .to_s , 2 )
end
if @new_dex != nil
if @new_dex > @actor .dex
self .contents .blt ( 164 , 224 , RPG::Cache .icon ( UP_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
elsif @new_dex < @actor .dex
self .contents .blt ( 164 , 224 , RPG::Cache .icon ( DOWN_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
end
self .contents .font .color = @new_dex >@actor.dex ? up_color : down_color
self .contents .font .color = normal_color if @new_dex == @actor .dex
self .contents .draw_text ( 200 , 224 , 36 , 32 , @new_dex .to_s , 2 )
end
if @new_agi != nil
if @new_agi > @actor .agi
self .contents .blt ( 164 , 256 , RPG::Cache .icon ( UP_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
elsif @new_agi < @actor .agi
self .contents .blt ( 164 , 256 , RPG::Cache .icon ( DOWN_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
end
self .contents .font .color = @new_agi >@actor.agi ? up_color : down_color
self .contents .font .color = normal_color if @new_agi == @actor .agi
self .contents .draw_text ( 200 , 256 , 36 , 32 , @new_agi .to_s , 2 )
end
if @new_int != nil
if @new_int > @actor .int
self .contents .blt ( 164 , 288 , RPG::Cache .icon ( UP_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
elsif @new_int < @actor .int
self .contents .blt ( 164 , 288 , RPG::Cache .icon ( DOWN_ICON) , Rect.new ( 0 , 0 , 24 , 24 ) )
end
self .contents .font .color = @new_int >@actor.int ? up_color : down_color
self .contents .font .color = normal_color if @new_int == @actor .int
self .contents .draw_text ( 200 , 288 , 36 , 32 , @new_int .to_s , 2 )
end
end
#--------------------------------------------------------------------------
# ● 变更装备后的能力值设置
# new_atk : 变更装备后的攻击力
# new_pdef : 变更装备后的物理防御
# new_mdef : 变更装备后的魔法防御
#--------------------------------------------------------------------------
###############################################################
def set_new_parameters( new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
if @new_atk != new_atk or @new_pdef !=new_pdef or @new_mdef != new_mdef or @new_eva != new_eva or @new_str != new_str or @new_dex !=new_dex or @new_agi != new_agi or @new_int != new_int
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_eva = new_eva
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
refresh
end
end
end
#==============================================================================
# ■ Window_EquipItem
#------------------------------------------------------------------------------
# 装备画面、显示浏览变更装备的候补物品的窗口。
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
# equip_type : 装备部位 (0~3)
#--------------------------------------------------------------------------
def initialize( actor, equip_type)
################改了改坐标和高度#################################
super ( 272 , 256 , 368 , 224 )
@actor = actor
@equip_type = equip_type
@column_max = 1
refresh
self .active = false
self .index = -1
end
#--------------------------------------------------------------------------
# ● 项目的描绘
# index : 项目符号
#--------------------------------------------------------------------------
def draw_item( index)
item = @data [ index]
################改了改坐标#################################
x = 4
y = index * 32
case item
when RPG::Weapon
number = $game_party .weapon_number ( item.id )
when RPG::Armor
number = $game_party .armor_number ( item.id )
end
bitmap = RPG::Cache .icon ( item.icon_name )
self .contents .blt ( x, y + 4 , bitmap, Rect.new ( 0 , 0 , 24 , 24 ) )
self .contents .font .color = normal_color
self .contents .draw_text ( x + 28 , y, 212 , 32 , item.name , 0 )
self .contents .draw_text ( x + 240 , y, 16 , 32 , ":" , 1 )
self .contents .draw_text ( x + 256 , y, 24 , 32 , number.to_s , 2 )
end
end
#==============================================================================
# ■ Scene_Equip
#------------------------------------------------------------------------------
# 处理装备画面的类。
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
# 设置物品窗口的可视状态
@item_window1 .visible = ( @right_window.index == 0 )
@item_window2 .visible = ( @right_window.index == 1 )
@item_window3 .visible = ( @right_window.index == 2 )
@item_window4 .visible = ( @right_window.index == 3 )
@item_window5 .visible = ( @right_window.index == 4 )
# 获取当前装备中的物品
item1 = @right_window .item
# 设置当前的物品窗口到 @item_window
case @right_window .index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end
# 右窗口被激活的情况下
if @right_window .active
# 删除变更装备后的能力
###############################################################
@left_window .set_new_parameters ( nil , nil , nil , nil , nil , nil , nil , nil )
end
# 物品窗口被激活的情况下
if @item_window .active
# 获取现在选中的物品
item2 = @item_window .item
# 变更装备
last_hp = @actor .hp
last_sp = @actor .sp
@actor .equip ( @right_window.index , item2 == nil ? 0 : item2.id )
# 获取变更装备后的能力值
###############################################################
new_atk = @actor .atk
new_pdef = @actor .pdef
new_mdef = @actor .mdef
new_eva = @actor .eva
new_str = @actor .str
new_dex = @actor .dex
new_agi = @actor .agi
new_int = @actor .int
# 返回到装备
@actor .equip ( @right_window.index , item1 == nil ? 0 : item1.id )
@actor .hp = last_hp
@actor .sp = last_sp
# 描画左窗口
###############################################################
@left_window .set_new_parameters ( new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
end
end
end
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
作者: 芯☆淡茹水 时间: 2015-3-17 21:37
已改#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
#==============================================================================
# ■ Harts_Window_ItemTitle
#------------------------------------------------------------------------------
# アイテム画面で、タイトルを表示するウィンドウ。
#==============================================================================
class Harts_Window_ItemTitle < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
end
end
#==============================================================================
# ■ Harts_Window_ItemCommand
#------------------------------------------------------------------------------
# アイテムの種別選択を行うウィンドウです。
#==============================================================================
class Harts_Window_ItemCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 64, 160, 288)
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 8
@commands = ["一般用", "战斗用", $data_system.words.weapon, $data_system.words.armor1, $data_system.words.armor2, $data_system.words.armor3, $data_system.words.armor4, "特殊道具"]
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
y = index * 32
self.contents.draw_text(4, y, 128, 32, @commands[index])
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
case self.index
when 0
@text = @commands[0]
when 1
@text = @commands[1]
when 2
@text = @commands[2]
when 3
@text = @commands[3]
when 4
@text = @commands[4]
when 5
@text = @commands[5]
when 6
@text = @commands[6]
when 7
@text = @commands[7]
end
@help_window.set_text(@text)
end
end
#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
# アイテム画面で、所持アイテムの一覧を表示するウィンドウです。
#==============================================================================
class Harts_Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(160, 0, 480, 416)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
end
#--------------------------------------------------------------------------
# ● アイテム一覧設定
# command : 選択中のコマンド
#--------------------------------------------------------------------------
def set_item(command)
refresh
case command
when 0
for i in 1...$data_items.size
if ($data_items[i].occasion == 0 or $data_items[i].occasion == 2) and $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
when 1
for i in 1...$data_items.size
if ($data_items[i].occasion == 1 and $game_party.item_number(i) > 0)
@data.push($data_items[i])
end
end
when 2
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
when 3
for i in 1...$data_armors.size
if $data_armors[i].kind == 0 and $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
when 4
for i in 1...$data_armors.size
if $data_armors[i].kind == 1 and $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
when 5
for i in 1...$data_armors.size
if $data_armors[i].kind == 2 and $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
when 6
for i in 1...$data_armors.size
if $data_armors[i].kind == 3 and $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
when 7
for i in 1...$data_items.size
if $data_items[i].occasion == 3 and $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
end
# 項目数が 0 でなければビットマップを作成し、全項目を描画
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 種類別アイテム数の取得
#--------------------------------------------------------------------------
def item_number
return @item_max
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
y = index * 32
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, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name.split("@")[0], 0)
self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# ■ Harts_Scene_Item
#------------------------------------------------------------------------------
# アイテム画面の処理を行うクラスです。再定義
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# タイトルウィンドウを作成
@itemtitle_window = Harts_Window_ItemTitle.new
#コマンドウィンドウを作成
@itemcommand_window = Harts_Window_ItemCommand.new
@command_index = @itemcommand_window.index
#アイテムウィンドウを作成
@itemlist_window = Harts_Window_ItemList.new
@itemlist_window.active = false
#ヘルプウィンドウを作成
@help_window = Window_Help.new
@help_window.x = 0
@help_window.y = 416
# ヘルプウィンドウを関連付け
@itemcommand_window.help_window = @help_window
@itemlist_window.help_window = @help_window
# ターゲットウィンドウを作成 (不可視?非アクティブに設定)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
# アイテムウィンドウ内容表示
@itemlist_window.set_item(@command_index)
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@itemtitle_window.dispose
@itemcommand_window.dispose
@itemlist_window.dispose
@help_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@itemtitle_window.update
@itemcommand_window.update
@itemlist_window.update
@help_window.update
@target_window.update
if @command_index != @itemcommand_window.index
@command_index = @itemcommand_window.index
@itemlist_window.set_item(@command_index)
end
# コマンドウィンドウがアクティブの場合: update_itemcommand を呼ぶ
if @itemcommand_window.active
update_itemcommand
return
end
# アイテムウィンドウがアクティブの場合: update_itemlist を呼ぶ
if @itemlist_window.active
update_itemlist
return
end
# ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (コマンドウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_itemcommand
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# メニュー画面に切り替え
$scene = Scene_Menu.new(0)
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 選択中のコマンドのアイテムがない場合
if @itemlist_window.item_number == 0
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# アイテムウィンドウをアクティブにする
@itemcommand_window.active = false
@itemlist_window.active = true
@itemlist_window.index = 0
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アイテムウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_itemlist
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# アイテムウィンドウをアクティブにする
@itemcommand_window.active = true
@itemlist_window.active = false
@itemlist_window.index = 0
@itemcommand_window.index = @command_index
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムウィンドウで現在選択されているデータを取得
@item = @itemlist_window.item
# 使用アイテムではない場合
unless @item.is_a?(RPG::Item)
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 使用できない場合
unless $game_party.item_can_use?(@item.id)
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# 効果範囲が味方の場合
if @item.scope >= 3
# ターゲットウィンドウをアクティブ化
@itemlist_window.active = false
@target_window.x = 304
@target_window.visible = true
@target_window.active = true
# 効果範囲 (単体/全体) に応じてカーソル位置を設定
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
# 効果範囲が味方以外の場合
else
# コモンイベント ID が有効の場合
if @item.common_event_id > 0
# コモンイベント呼び出し予約
$game_temp.common_event_id = @item.common_event_id
# アイテムの使用時 SE を演奏
$game_system.se_play(@item.menu_se)
# 消耗品の場合
if @item.consumable
# 使用したアイテムを 1 減らす
$game_party.lose_item(@item.id, 1)
# アイテムウィンドウの項目を再描画
@itemlist_window.draw_item(@itemlist_window.index)
end
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
end
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_target
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# アイテム切れなどで使用できなくなった場合
unless $game_party.item_can_use?(@item.id)
# アイテムウィンドウの内容を再作成
@itemlist_window.refresh
end
# ターゲットウィンドウを消去
@itemlist_window.active = true
@target_window.visible = false
@target_window.active = false
@itemlist_window.set_item(@command_index)
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムを使い切った場合
if $game_party.item_number(@item.id) == 0
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# ターゲットが全体の場合
if @target_window.index == -1
# パーティ全体にアイテムの使用効果を適用
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# ターゲットが単体の場合
if @target_window.index >= 0
# ターゲットのアクターにアイテムの使用効果を適用
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
end
# アイテムを使った場合
if used
# アイテムの使用時 SE を演奏
$game_system.se_play(@item.menu_se)
# 消耗品の場合
if @item.consumable
# 使用したアイテムを 1 減らす
$game_party.lose_item(@item.id, 1)
# アイテムウィンドウの項目を再描画
@itemlist_window.draw_item(@itemlist_window.index)
@itemlist_window.set_item(@command_index)
end
# ターゲットウィンドウの内容を再作成
@target_window.refresh
# 全滅の場合
if $game_party.all_dead?
# ゲームオーバー画面に切り替え
$scene = Scene_Gameover.new
return
end
# コモンイベント ID が有効の場合
if @item.common_event_id > 0
# コモンイベント呼び出し予約
$game_temp.common_event_id = @item.common_event_id
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
end
# アイテムを使わなかった場合
unless used
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
复制代码 #==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# 游戏中全部窗口的超级类。
#==============================================================================
class Window_Base < Window
def up_color
return Color.new(255, 0, 0)
end
def down_color
return Color.new(0, 255, 0)
end
#--------------------------------------------------------------------------
# ● 描绘能力值
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# type : 能力值种类 (0~6)
#--------------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
###############################################################
when 7
parameter_name = "回避"
parameter_value = actor.eva
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end
end
#==============================================================================
# ■ Window_EquipLeft
#------------------------------------------------------------------------------
# 装备画面的、显示角色能力值变化的窗口。
#==============================================================================
class Window_EquipLeft < Window_Base
UP_ICON = "048-Skill05"
DOWN_ICON = "047-Skill04"
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 64, 272, 416)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_level(@actor, 4, 32)
###############################################################
draw_actor_parameter(@actor, 4, 64, 0)
draw_actor_parameter(@actor, 4, 96, 1)
draw_actor_parameter(@actor, 4, 128, 2)
draw_actor_parameter(@actor, 4, 160, 7)
draw_actor_parameter(@actor, 4, 192, 3)
draw_actor_parameter(@actor, 4, 224, 4)
draw_actor_parameter(@actor, 4, 256, 5)
draw_actor_parameter(@actor, 4, 288, 6)
if @new_atk != nil
if @new_atk > @actor.atk
self.contents.blt(164, 64, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
elsif @new_atk < @actor.atk
self.contents.blt(164, 64, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
end
self.contents.font.color = @new_atk>@actor.atk ? up_color : down_color
self.contents.font.color = normal_color if @new_atk == @actor.atk
self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
end
if @new_pdef != nil
if @new_pdef > @actor.pdef
self.contents.blt(164, 96, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
elsif @new_pdef < @actor.pdef
self.contents.blt(164, 96, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
end
self.contents.font.color = @new_pdef>@actor.pdef ? up_color : down_color
self.contents.font.color = normal_color if @new_pdef == @actor.pdef
self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
end
if @new_mdef != nil
if @new_mdef > @actor.mdef
self.contents.blt(164, 128, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
elsif @new_mdef < @actor.mdef
self.contents.blt(164, 128, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
end
self.contents.font.color = @new_mdef>@actor.mdef ? up_color : down_color
self.contents.font.color = normal_color if @new_mdef == @actor.mdef
self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
end
if @new_eva != nil
if @new_eva > @actor.eva
self.contents.blt(164, 160, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
elsif @new_eva < @actor.eva
self.contents.blt(164, 160, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
end
self.contents.font.color = @new_eva>@actor.eva ? up_color : down_color
self.contents.font.color = normal_color if @new_eva == @actor.eva
self.contents.draw_text(200, 160, 36, 32, @new_eva.to_s, 2)
end
if @new_str != nil
if @new_str > @actor.str
self.contents.blt(164, 192, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
elsif @new_str < @actor.str
self.contents.blt(164, 192, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
end
self.contents.font.color = @new_str>@actor.str ? up_color : down_color
self.contents.font.color = normal_color if @new_str == @actor.str
self.contents.draw_text(200, 192, 36, 32, @new_str.to_s, 2)
end
if @new_dex != nil
if @new_dex > @actor.dex
self.contents.blt(164, 224, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
elsif @new_dex < @actor.dex
self.contents.blt(164, 224, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
end
self.contents.font.color = @new_dex>@actor.dex ? up_color : down_color
self.contents.font.color = normal_color if @new_dex == @actor.dex
self.contents.draw_text(200, 224, 36, 32, @new_dex.to_s, 2)
end
if @new_agi != nil
if @new_agi > @actor.agi
self.contents.blt(164, 256, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
elsif @new_agi < @actor.agi
self.contents.blt(164, 256, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
end
self.contents.font.color = @new_agi>@actor.agi ? up_color : down_color
self.contents.font.color = normal_color if @new_agi == @actor.agi
self.contents.draw_text(200, 256, 36, 32, @new_agi.to_s, 2)
end
if @new_int != nil
if @new_int > @actor.int
self.contents.blt(164, 288, RPG::Cache.icon(UP_ICON), Rect.new(0, 0, 24, 24))
elsif @new_int < @actor.int
self.contents.blt(164, 288, RPG::Cache.icon(DOWN_ICON), Rect.new(0, 0, 24, 24))
end
self.contents.font.color = @new_int>@actor.int ? up_color : down_color
self.contents.font.color = normal_color if @new_int == @actor.int
self.contents.draw_text(200, 288, 36, 32, @new_int.to_s, 2)
end
end
#--------------------------------------------------------------------------
# ● 变更装备后的能力值设置
# new_atk : 变更装备后的攻击力
# new_pdef : 变更装备后的物理防御
# new_mdef : 变更装备后的魔法防御
#--------------------------------------------------------------------------
###############################################################
def set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
if @new_atk != new_atk or @new_pdef !=new_pdef or @new_mdef != new_mdef or @new_eva != new_eva or @new_str != new_str or @new_dex !=new_dex or @new_agi != new_agi or @new_int != new_int
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_eva = new_eva
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
refresh
end
end
end
#==============================================================================
# ■ Window_EquipItem
#------------------------------------------------------------------------------
# 装备画面、显示浏览变更装备的候补物品的窗口。
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
# equip_type : 装备部位 (0~3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
################改了改坐标和高度#################################
super(272, 256, 368, 224)
@actor = actor
@equip_type = equip_type
@column_max = 1
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● 项目的描绘
# index : 项目符号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
################改了改坐标#################################
x = 4
y = index * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name.split("@")[0], 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end
#==============================================================================
# ■ Scene_Equip
#------------------------------------------------------------------------------
# 处理装备画面的类。
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
# 设置物品窗口的可视状态
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
# 获取当前装备中的物品
item1 = @right_window.item
# 设置当前的物品窗口到 @item_window
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end
# 右窗口被激活的情况下
if @right_window.active
# 删除变更装备后的能力
###############################################################
@left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
end
# 物品窗口被激活的情况下
if @item_window.active
# 获取现在选中的物品
item2 = @item_window.item
# 变更装备
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
# 获取变更装备后的能力值
###############################################################
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
new_eva = @actor.eva
new_str = @actor.str
new_dex = @actor.dex
new_agi = @actor.agi
new_int = @actor.int
# 返回到装备
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# 描画左窗口
###############################################################
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
end
end
end
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
复制代码
作者: qkqwe 时间: 2015-3-18 20:17
芯☆淡茹水 发表于 2015-3-17 21:37
已改
感谢大神!完美解决!
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1