赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 2 |
经验 | 0 |
最后登录 | 2023-11-18 |
在线时间 | 36 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 198
- 在线时间
- 36 小时
- 注册时间
- 2023-7-9
- 帖子
- 7
|
2楼
楼主 |
发表于 2023-9-18 21:42:26
|
只看该作者
#根据防具名后边加分隔符","与数字确定以及追加防具种类,默认追加两种,但完全可以照葫芦画瓢追加更多。
#例如盾牌种类的命名方式为:
#木盾,0
#数字对应防具种类
#0: 盾
#1: 头部防具
#2: 身体防具
#3: 装饰品
#4: 项链@new_int
#5: 鞋子
#实际应用需要对所有与装备有关的窗口进行调整,其中项链与鞋子的名字没有直接给出,菜单中直接用文本体现。
#注:后面不加分隔符分隔符","与数字,防具种类恢复数据库默认类型。
#直接插在Main前即可,注意全脚本对相应窗口的菜单进行了美化处理,如果只想要增加防具种类功能只插入脚本1至326行的内容即可。
#装备扩展(脚本内容)
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#
# 防具类追加
#
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
module RPG
class Armor
def name
name = @name.split(/_/)[0]
return name != nil ? name : ''
end
def kind
kind = @name.split(/_/)[1]
return kind != nil ? kind.to_i : @kind
end
end
end
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#
# 防具类追加
#
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
module RPG
class Actor
def setup
@armor5_id = 0
@armor6_id = 0
@armor7_id = 0
@armor5_fix = false
@armor6_fix = false
@armor7_fix = false
end
attr_accessor :armor5_id
attr_accessor :armor6_id
attr_accessor :armor7_id
attr_accessor :armor5_fix
attr_accessor :armor6_fix
attr_accessor :armor7_fix
end
class Armor
def kind
kind = @name.split(/_/)[1]
return kind != nil ? kind.to_i : @kind
end
def name
name = @name.split(/_/)[0]
return name != nil ? name : ''
end
end
end
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#
# Game_Actor添加新的防具ID,并对相关方法修正
#
#
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
class Game_Actor < Game_Battler
attr_reader :armor5_id # 项链 ID
attr_reader :armor6_id
attr_reader :armor7_id
# 鞋 ID
#--------------------------------------------------------------------------
# ● 初始化对像
# actor_id : 角色 ID
#--------------------------------------------------------------------------
def initialize(actor_id)
super()
setup(actor_id)
end
#--------------------------------------------------------------------------
# ● 设置
# actor_id : 角色 ID
#--------------------------------------------------------------------------
alias old_setup setup
def setup(actor_id)
old_setup(actor_id)
actor = $data_actors[actor_id]
@armor5_id = 0
@armor6_id = 0
@armor7_id = 0
update_auto_state(nil, $data_armors[@armor5_id])
update_auto_state(nil, $data_armors[@armor6_id])
update_auto_state(nil, $data_armors[@armor7_id])
end
#--------------------------------------------------------------------------
# ● 取得属性修正值
# element_id : 属性 ID
#--------------------------------------------------------------------------
def element_rate(element_id)
# 获取对应属性有效度的数值
table = [0,200,150,100,50,0,-100]
result = table[$data_classes[@class_id].element_ranks[element_id]]
# 防具能防御本属性的情况下效果减半
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id, @armor7_id]
armor = $data_armors[i]
if armor != nil and armor.guard_element_set.include?(element_id)
result /= 2
end
end
# 状态能防御本属性的情况下效果减半
for i in @states
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
end
# 过程结束
return result
end
#--------------------------------------------------------------------------
# ● 判定防御属性
# state_id : 属性 ID
#--------------------------------------------------------------------------
def state_guard?(state_id)
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id, @armor7_id]
armor = $data_armors[i]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
end
return false
end
#--------------------------------------------------------------------------
# ● 获取基本力量
#--------------------------------------------------------------------------
def base_str
n = $data_actors[@actor_id].parameters[2, @level]
weapon = $data_weapons[@weapon_id]
armor1_id = $data_armors[@armor1_id]
armor2_id = $data_armors[@armor2_id]
armor3_id = $data_armors[@armor3_id]
armor4_id = $data_armors[@armor4_id]
armor5_id = $data_armors[@armor5_id]
armor6_id = $data_armors[@armor6_id]
armor7_id = $data_armors[@armor7_id]
n += weapon != nil ? weapon.str_plus : 0
n += armor1_id != nil ? armor1_id.str_plus : 0
n += armor2_id != nil ? armor2_id.str_plus : 0
n += armor3_id != nil ? armor3_id.str_plus : 0
n += armor4_id != nil ? armor4_id.str_plus : 0
n += armor5_id != nil ? armor5_id.str_plus : 0
n += armor6_id != nil ? armor6_id.str_plus : 0
n += armor7_id != nil ? armor7_id.str_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本灵巧
#--------------------------------------------------------------------------
def base_dex
n = $data_actors[@actor_id].parameters[3, @level]
weapon = $data_weapons[@weapon_id]
armor1_id = $data_armors[@armor1_id]
armor2_id = $data_armors[@armor2_id]
armor3_id = $data_armors[@armor3_id]
armor4_id = $data_armors[@armor4_id]
armor5_id = $data_armors[@armor5_id]
armor6_id = $data_armors[@armor6_id]
armor7_id = $data_armors[@armor7_id]
n += weapon != nil ? weapon.dex_plus : 0
n += armor1_id != nil ? armor1_id.dex_plus : 0
n += armor2_id != nil ? armor2_id.dex_plus : 0
n += armor3_id != nil ? armor3_id.dex_plus : 0
n += armor4_id != nil ? armor4_id.dex_plus : 0
n += armor5_id != nil ? armor5_id.dex_plus : 0
n += armor6_id != nil ? armor6_id.dex_plus : 0
n += armor7_id != nil ? armor7_id.dex_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本速度
#--------------------------------------------------------------------------
def base_agi
n = $data_actors[@actor_id].parameters[4, @level]
weapon = $data_weapons[@weapon_id]
armor1_id = $data_armors[@armor1_id]
armor2_id = $data_armors[@armor2_id]
armor3_id = $data_armors[@armor3_id]
armor4_id = $data_armors[@armor4_id]
armor5_id = $data_armors[@armor5_id]
armor6_id = $data_armors[@armor6_id]
armor7_id = $data_armors[@armor7_id]
n += weapon != nil ? weapon.agi_plus : 0
n += armor1_id != nil ? armor1_id.agi_plus : 0
n += armor2_id != nil ? armor2_id.agi_plus : 0
n += armor3_id != nil ? armor3_id.agi_plus : 0
n += armor4_id != nil ? armor4_id.agi_plus : 0
n += armor5_id != nil ? armor5_id.agi_plus : 0
n += armor6_id != nil ? armor6_id.agi_plus : 0
n += armor7_id != nil ? armor7_id.agi_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本魔力
#--------------------------------------------------------------------------
def base_int
n = $data_actors[@actor_id].parameters[5, @level]
weapon = $data_weapons[@weapon_id]
armor1_id = $data_armors[@armor1_id]
armor2_id = $data_armors[@armor2_id]
armor3_id = $data_armors[@armor3_id]
armor4_id = $data_armors[@armor4_id]
armor5_id = $data_armors[@armor5_id]
armor6_id = $data_armors[@armor6_id]
armor7_id = $data_armors[@armor7_id]
n += weapon != nil ? weapon.int_plus : 0
n += armor1_id != nil ? armor1_id.int_plus : 0
n += armor2_id != nil ? armor2_id.int_plus : 0
n += armor3_id != nil ? armor3_id.int_plus : 0
n += armor4_id != nil ? armor4_id.int_plus : 0
n += armor5_id != nil ? armor5_id.int_plus : 0
n += armor6_id != nil ? armor6_id.int_plus : 0
n += armor7_id != nil ? armor7_id.int_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本物理防御
#--------------------------------------------------------------------------
def base_pdef
weapon = $data_weapons[@weapon_id]
armor1_id = $data_armors[@armor1_id]
armor2_id = $data_armors[@armor2_id]
armor3_id = $data_armors[@armor3_id]
armor4_id = $data_armors[@armor4_id]
armor5_id = $data_armors[@armor5_id]
armor6_id = $data_armors[@armor6_id]
armor7_id = $data_armors[@armor7_id]
n = 0
n += weapon != nil ? weapon.pdef : 0
n += armor1_id != nil ? armor1_id.pdef : 0
n += armor2_id != nil ? armor2_id.pdef : 0
n += armor3_id != nil ? armor3_id.pdef : 0
n += armor4_id != nil ? armor4_id.pdef : 0
n += armor5_id != nil ? armor5_id.pdef : 0
n += armor6_id != nil ? armor6_id.pdef : 0
n += armor7_id != nil ? armor7_id.pdef : 0
return n
end
#--------------------------------------------------------------------------
# ● 获取基本魔法防御
#--------------------------------------------------------------------------
def base_mdef
weapon = $data_weapons[@weapon_id]
armor1_id = $data_armors[@armor1_id]
armor2_id = $data_armors[@armor2_id]
armor3_id = $data_armors[@armor3_id]
armor4_id = $data_armors[@armor4_id]
armor5_id = $data_armors[@armor5_id]
armor6_id = $data_armors[@armor6_id]
armor7_id = $data_armors[@armor7_id]
n = 0
n += weapon != nil ? weapon.mdef : 0
n += armor1_id != nil ? armor1_id.mdef : 0
n += armor2_id != nil ? armor2_id.mdef : 0
n += armor3_id != nil ? armor3_id.mdef : 0
n += armor4_id != nil ? armor4_id.mdef : 0
n += armor5_id != nil ? armor5_id.mdef : 0
n += armor6_id != nil ? armor6_id.mdef : 0
n += armor7_id != nil ? armor7_id.mdef : 0
return n
end
#--------------------------------------------------------------------------
# ● 获取基本回避修正
#--------------------------------------------------------------------------
def base_eva
armor1_id = $data_armors[@armor1_id]
armor2_id = $data_armors[@armor2_id]
armor3_id = $data_armors[@armor3_id]
armor4_id = $data_armors[@armor4_id]
armor5_id = $data_armors[@armor5_id]
armor6_id = $data_armors[@armor6_id]
armor7_id = $data_armors[@armor7_id]
n = 0
n += armor1_id != nil ? armor1_id.eva : 0
n += armor2_id != nil ? armor2_id.eva : 0
n += armor3_id != nil ? armor3_id.eva : 0
n += armor4_id != nil ? armor4_id.eva : 0
n += armor5_id != nil ? armor5_id.eva : 0
n += armor6_id != nil ? armor6_id.eva : 0
n += armor7_id != nil ? armor7_id.eva : 0
return n
end
#--------------------------------------------------------------------------
# ● 装备固定判定
# equip_type : 装备类型
#--------------------------------------------------------------------------
def equip_fix?(equip_type)
case equip_type
when 0 # 武器
return $data_actors[@actor_id].weapon_fix
when 1 # 盾
return $data_actors[@actor_id].armor1_fix
when 2 # 头
return $data_actors[@actor_id].armor2_fix
when 3 # 身体
return $data_actors[@actor_id].armor3_fix
when 4 # 装饰品
return $data_actors[@actor_id].armor4_fix
when 5 # 装饰品
return $data_actors[@actor_id].armor5_fix
when 6 # 装饰品
return $data_actors[@actor_id].armor6_fix
when 7 # 装饰品
return $data_actors[@actor_id].armor7_fix
end
return false
end
#--------------------------------------------------------------------------
# ● 变更装备
# equip_type : 装备类型
# id : 武器 or 防具 ID (0 为解除装备)
#--------------------------------------------------------------------------
def equip(equip_type, id)
case equip_type
when 0 # 武器
if id == 0 or $game_party.weapon_number(id) > 0
$game_party.gain_weapon(@weapon_id, 1)
@weapon_id = id
$game_party.lose_weapon(id, 1)
end
when 1 # 盾
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor1_id], $data_armors[id])
$game_party.gain_armor(@armor1_id, 1)
@armor1_id = id
$game_party.lose_armor(id, 1)
end
when 2 # 头
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor2_id], $data_armors[id])
$game_party.gain_armor(@armor2_id, 1)
@armor2_id = id
$game_party.lose_armor(id, 1)
end
when 3 # 身体
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor3_id], $data_armors[id])
$game_party.gain_armor(@armor3_id, 1)
@armor3_id = id
$game_party.lose_armor(id, 1)
end
when 4 # 装饰品
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor4_id], $data_armors[id])
$game_party.gain_armor(@armor4_id, 1)
@armor4_id = id
$game_party.lose_armor(id, 1)
end
when 5 # 项链
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor5_id], $data_armors[id])
$game_party.gain_armor(@armor5_id, 1)
@armor5_id = id
$game_party.lose_armor(id, 1)
end
when 6 # 鞋
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor6_id], $data_armors[id])
$game_party.gain_armor(@armor6_id, 1)
@armor6_id = id
$game_party.lose_armor(id, 1)
end
when 7 # 项链
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor7_id], $data_armors[id])
$game_party.gain_armor(@armor7_id, 1)
@armor7_id = id
$game_party.lose_armor(id, 1)
end
end
end
#--------------------------------------------------------------------------
# ● 更改职业 ID
# class_id : 新的职业 ID
#--------------------------------------------------------------------------
def class_id=(class_id)
if $data_classes[class_id] != nil
@class_id = class_id
# 避开无法装备的物品
unless equippable?($data_weapons[@weapon_id])
equip(0, 0)
end
unless equippable?($data_armors[@armor1_id])
equip(1, 0)
end
unless equippable?($data_armors[@armor2_id])
equip(2, 0)
end
unless equippable?($data_armors[@armor3_id])
equip(3, 0)
end
unless equippable?($data_armors[@armor4_id])
equip(4, 0)
end
unless equippable?($data_armors[@armor5_id])
equip(5, 0)
end
unless equippable?($data_armors[@armor6_id])
equip(6, 0)
end
unless equippable?($data_armors[@armor7_id])
equip(7, 0)
end
end
end
end
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#
# Window_Base美化,增加属性增减颜色,及全能力值描绘
#
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#==============================================================================
# ■ 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
when 8
parameter_name = "MP"
parameter_value = actor.sp
when 9
parameter_name = "HP"
parameter_value = actor.hp
end
self.contents.font.color = Color.new(250, 150, 50) #
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_EquipRight
#------------------------------------------------------------------------------
# 装备画面、显示角色现在装备的物品的窗口。
#==============================================================================
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(390, 74, 250, 290)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = []
@data.push($data_weapons[@actor.weapon_id])
@data.push($data_armors[@actor.armor1_id])
@data.push($data_armors[@actor.armor2_id])
@data.push($data_armors[@actor.armor3_id])
@data.push($data_armors[@actor.armor4_id])
@data.push($data_armors[@actor.armor5_id])
@data.push($data_armors[@actor.armor6_id])
@data.push($data_armors[@actor.armor7_id])
@item_max = @data.size
self.contents.font.color = system_color
self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
self.contents.draw_text(4, 32 * 4, 92, 32, $data_system.words.armor4)
self.contents.draw_text(4, 32 * 5, 92, 32, "首饰")
self.contents.draw_text(4, 32 * 6, 92, 32, "背包")
self.contents.draw_text(4, 32 * 7, 92, 32, "挂件")
draw_item_name(@data[0], 64, 32 * 0)
draw_item_name(@data[1], 64, 32 * 1)
draw_item_name(@data[2], 64, 32 * 2)
draw_item_name(@data[3], 64, 32 * 3)
draw_item_name(@data[4], 64, 32 * 4)
draw_item_name(@data[5], 64, 32 * 5)
draw_item_name(@data[6], 64, 32 * 6)
draw_item_name(@data[7], 64, 32 * 7)
end
end
#==============================================================================
# ■ Window_EquipLeft
#------------------------------------------------------------------------------
# 装备画面的、显示角色能力值变化的窗口。
#==============================================================================
class Window_EquipLeft < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 74, 390, 406)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 0, -5)
draw_actor_level(@actor, 0, 26)
bitmap=Bitmap.new("Graphics/battlers/actor2/#{@actor.id}")
self.contents.blt(0,25,bitmap,Rect.new(-160,0,488,360),255)
draw_actor_parameter(@actor, 0, 46, 0)#攻击
draw_actor_parameter(@actor, 0, 78, 1)#物防
draw_actor_parameter(@actor, 0, 110, 2)#魔防
draw_actor_parameter(@actor, 0, 142, 3)#力量
draw_actor_parameter(@actor, 0, 174, 4)#灵巧
draw_actor_parameter(@actor, 0, 206, 5)#速度
draw_actor_parameter(@actor, 0, 238, 6)#魔力
draw_actor_parameter(@actor, 0, 270, 7)#回避
draw_actor_parameter(@actor, 0, 334, 8)#MP
draw_actor_parameter(@actor, 0, 302, 9)#HP
if @new_atk != nil
self.contents.font.color = system_color#攻击
self.contents.draw_text(90, 46, 40, 32, "←", 1)
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(65, 46, 36, 32, @new_atk.to_s, 2)
end
if @new_pdef != nil#物防
self.contents.font.color = system_color
self.contents.draw_text(90, 78, 40, 32, "←", 1)
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(65, 78, 36, 32, @new_pdef.to_s, 2)
end
if @new_mdef != nil#魔防
self.contents.font.color = system_color
self.contents.draw_text(90, 110, 40, 32, "←", 1)
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(65, 110, 36, 32, @new_mdef.to_s, 2)
end
if @new_eva != nil#回避
self.contents.font.color = system_color
self.contents.draw_text(90, 270, 40, 32, "←", 1)
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(65, 270, 36, 32, @new_eva.to_s, 2)
end
if @new_str != nil#力量
self.contents.font.color = system_color
self.contents.draw_text(90, 142, 40, 32, "←", 1)
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(65, 142, 36, 32, @new_str.to_s, 2)
end
if @new_dex != nil#灵巧
self.contents.font.color = system_color
self.contents.draw_text(90, 174, 40, 32, "←", 1)
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(65, 174, 36, 32, @new_dex.to_s, 2)
end
if @new_agi != nil#速度
self.contents.font.color = system_color
self.contents.draw_text(90, 206, 40, 32, "←", 1)
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(65, 206, 36, 32, @new_agi.to_s, 2)
end
if @new_int != nil#魔力
self.contents.font.color = system_color
self.contents.draw_text(90, 238, 40, 32, "←", 1)
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(65, 238, 36, 32, @new_int.to_s, 2)
end
if @new_hp!=nil #HP
self.contents.font.color = system_color
self.contents.draw_text(80, 302, 40, 32, "←", 1)
self.contents.font.color = @new_hp>@actor.hp ? up_color : down_color
self.contents.font.color = normal_color if @new_hp == @actor.hp
self.contents.draw_text(45, 302, 36, 32, @new_hp.to_s, 2)
end
if @new_sp!=nil#SP
self.contents.font.color = system_color
self.contents.draw_text(80, 334, 40, 32, "←", 1)
self.contents.font.color = @new_sp>@actor.sp ? up_color : down_color
self.contents.font.color = normal_color if @new_sp == @actor.sp
self.contents.draw_text(45, 334, 36, 32, @new_sp.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,new_hp,new_sp)
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 or @new_hp != new_hp or @new_sp != new_sp
@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
@new_hp = new_hp
@new_sp = new_sp
refresh
end
end
end
#==============================================================================
# ■ Window_EquipItem
#------------------------------------------------------------------------------
# 装备画面、显示浏览变更装备的候补物品的窗口。
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
# equip_type : 装备部位 (0~3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(390, 362, 250, 118)
@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 + 160, y, 16, 32, ":", 1)
self.contents.draw_text(x + 180, y, 24, 32, number.to_s, 2)
end
end
class Scene_Equip
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
# 获取角色
@actor = $game_party.actors[@actor_index]
# 生成窗口
@help_window = Window_Help.new
@left_window = Window_EquipLeft.new(@actor)
@right_window = Window_EquipRight.new(@actor)
@item_window1 = Window_EquipItem.new(@actor, 0)
@item_window2 = Window_EquipItem.new(@actor, 1)
@item_window3 = Window_EquipItem.new(@actor, 2)
@item_window4 = Window_EquipItem.new(@actor, 3)
@item_window5 = Window_EquipItem.new(@actor, 4)
@item_window6 = Window_EquipItem.new(@actor, 5)
@item_window7 = Window_EquipItem.new(@actor, 6)
@item_window8 = Window_EquipItem.new(@actor, 7)
# 关联帮助窗口
@right_window.help_window = @help_window
@item_window1.help_window = @help_window
@item_window2.help_window = @help_window
@item_window3.help_window = @help_window
@item_window4.help_window = @help_window
@item_window5.help_window = @help_window
@item_window6.help_window = @help_window
@item_window7.help_window = @help_window
@item_window8.help_window = @help_window
# 设置光标位置
@right_window.index = @equip_index
refresh
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话的就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@help_window.dispose
@left_window.dispose
@right_window.dispose
@item_window1.dispose
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
@item_window6.dispose
@item_window7.dispose
@item_window8.dispose
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
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)
@item_window6.visible = (@right_window.index == 5)
@item_window7.visible = (@right_window.index == 6)
@item_window8.visible = (@right_window.index == 7)
# 获取当前装备中的物品
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
when 5
@item_window = @item_window6
when 6
@item_window = @item_window7
when 7
@item_window = @item_window8
end
# 右窗口被激活的情况下
if @right_window.active
# 删除变更装备后的能力
###############################################################
@left_window.set_new_parameters(nil, nil, 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
new_hp = @actor.hp
new_sp = @actor.sp
# 返回到装备
@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, new_hp, new_sp)
###############################################################
end
end
end
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#
# 状态窗口美化,全防具装备栏描绘
#
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#==============================================================================
# ■ Window_Status
#------------------------------------------------------------------------------
# 显示状态画面、完全规格的状态窗口。
#==============================================================================
class Window_Status < Window_Base
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic(@actor, 404, 355)
draw_actor_name(@actor, 0, 0)
draw_actor_class(@actor, 4 + 200, 0)
draw_actor_level(@actor, 64, 0)
draw_actor_state(@actor, 340 ,0)
draw_actor_hp(@actor, 208, 42, 172)
draw_actor_sp(@actor, 400, 42, 172)
draw_actor_parameter(@actor, 208, 74, 0)
draw_actor_parameter(@actor, 208, 106, 1)
draw_actor_parameter(@actor, 208, 138, 2)
draw_actor_parameter(@actor, 208, 170, 3)
draw_actor_parameter(@actor, 370, 74, 4)
draw_actor_parameter(@actor, 370, 106, 5)
draw_actor_parameter(@actor, 370, 138, 6)
draw_actor_parameter(@actor, 370, 170, 7)
self.contents.font.color = system_color
self.contents.draw_text(20, 395, 80, 32, "当前经验")
self.contents.draw_text(20, 422, 80, 32, "所需经验")
# self.contents.draw_text(0, 112, 120, 32, "学习点数")
self.contents.draw_text(0, 398, 200, 32, "_____________________________________:")
self.contents.draw_text(138, 0, 96, 32, "称号:")
self.contents.draw_text(288, 00, 96, 32, "状态:")
#self.contents.draw_text(400, 0, 96, 32, "当前装备:")
#self.contents.draw_text(180, 240, 96, 32, "武器:")
# self.contents.draw_text(310, 60, 96, 32, "护手:")
# self.contents.draw_text(310, 90, 96, 32, "项链:")
# self.contents.draw_text(310, 120, 96, 32, "衣服:")
# self.contents.draw_text(310, 150, 96, 32, "戒指:")
# self.contents.draw_text(310, 180, 96, 32, "腰带:")
#self.contents.draw_text(310, 210, 96, 32, "鞋子:")
draw_item_name($data_weapons[@actor.weapon_id], 217 + 6, 238)
draw_item_name($data_armors[@actor.armor1_id], 438 + 6, 240)
draw_item_name($data_armors[@actor.armor2_id], 315 + 6, 205)
draw_item_name($data_armors[@actor.armor3_id], 198 + 6, 295)
draw_item_name($data_armors[@actor.armor4_id], 460 + 6, 295)
draw_item_name($data_armors[@actor.armor5_id], 438 + 6, 397)
draw_item_name($data_armors[@actor.armor6_id], 217 + 6, 397)
draw_item_name($data_armors[@actor.armor7_id], 315 + 6, 422)
self.contents.font.color = normal_color
self.contents.draw_text(10 + 82, 397, 84, 32, @actor.exp_s, 2)
self.contents.draw_text(10 + 82, 422, 84, 32, @actor.next_rest_exp_s, 2)
# self.contents.draw_text(0 + 120, 112, 80, 32, $game_variables[@actor.id].to_s)
# draw_actor_guard_state(@actor, 320, 144)
draw_actor_element_radar_graph(@actor, 320, 240)
cx = contents.text_size("体力").width
self.contents.font.color = Color.new(100, 250, 50)
self.contents.draw_text(525, 0, 120-cx-2, 188, $game_variables[21].to_s, 2)
self.contents.font.color = Color.new(255, 0, 0) #
self.contents.draw_text(570-cx, 80, cx, 25, "体力" , 2)
cx = contents.text_size("幸运").width
self.contents.font.color = Color.new(100, 240, 50) #
self.contents.draw_text(525, 20, 120-cx-2, 188, $game_variables[22].to_s, 2)
self.contents.font.color = Color.new(240, 100, 50)
self.contents.draw_text(570-cx, 100, cx, 25, "幸运" , 2)
cx = contents.text_size("睡眠").width
self.contents.font.color = Color.new(100, 230, 50) #
self.contents.draw_text(525, 40, 120-cx-2, 188, $game_variables[23].to_s, 2)
self.contents.font.color = Color.new(191, 64, 191)
self.contents.draw_text(570-cx, 120, cx, 25, "睡眠" , 2)
cx = contents.text_size("吃喝").width
self.contents.font.color = Color.new(100, 220, 50) #
self.contents.draw_text(525, 60, 120-cx-2, 188, $game_variables[24].to_s, 2)
self.contents.font.color = Color.new(0, 127, 255)
self.contents.draw_text(570-cx, 140, cx, 25, "吃喝" , 2)
cx = contents.text_size("拉撒").width
self.contents.font.color = Color.new(100, 210, 50) #
self.contents.draw_text(525, 80, 120-cx-2, 188, $game_variables[25].to_s, 2)
self.contents.font.color = Color.new(250, 200, 0)
self.contents.draw_text(570-cx, 160, cx, 25, "拉撒" , 2)
cx = contents.text_size("诅咒").width
self.contents.font.color = Color.new(100, 200, 50) #
self.contents.draw_text(525, 100, 120-cx-2, 188, $game_variables[26].to_s, 2)
self.contents.font.color = Color.new(0, 250, 250)
self.contents.draw_text(570-cx, 180, cx, 25, "诅咒" , 2)
# cx = contents.text_size("按Z键查看人物档案").width
# self.contents.font.color = normal_color
# self.contents.draw_text(4, 90, 150-cx-2, 308, $game_variables[99].to_s, 2)
#self.contents.font.color = system_color
#self.contents.draw_text(120-cx, 30, cx, 32, "按Z键查看人物" , 2)
bitmap=Bitmap.new("Graphics/battlers/actor2/#{@actor.id}")
self.contents.blt(4,25,bitmap,Rect.new(0,-20,188,370),255)
end
def dummy
self.contents.font.color = system_color
self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor5)
self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor6)
self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor7)
draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
draw_item_name($data_armors[@actor.armor5_id], 320 + 24, 400)
draw_item_name($data_armors[@actor.armor6_id], 320 + 24, 400)
draw_item_name($data_armors[@actor.armor7_id], 320 + 24, 400)
end
end
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#
# 商店购买窗口美化,增加对新装备位置的描述
#
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#==============================================================================
# ■ Window_ShopStatus
#------------------------------------------------------------------------------
# 商店画面、显示物品所持数与角色装备的窗口。
#==============================================================================
class Window_ShopStatus < Window_Base
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @item == nil
return
end
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
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 200, 32, "所持数")
self.contents.font.color = normal_color
self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
if @item.is_a?(RPG::Item)
return
end
# 添加装备品信息
for i in 0...$game_party.actors.size
# 获取角色
actor = $game_party.actors[i]
# 可以装备为普通文字颜色、不能装备设置为无效文字颜色
if actor.equippable?(@item)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
# 描绘角色名字
self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
# 获取当前的装备品
if @item.is_a?(RPG::Weapon)
item1 = $data_weapons[actor.weapon_id]
elsif @item.kind == 0
item1 = $data_armors[actor.armor1_id]
elsif @item.kind == 1
item1 = $data_armors[actor.armor2_id]
elsif @item.kind == 2
item1 = $data_armors[actor.armor3_id]
elsif @item.kind == 3
item1 = $data_armors[actor.armor4_id]
elsif @item.kind == 4
item1 = $data_armors[actor.armor5_id]
elsif @item.kind == 5
item1 = $data_armors[actor.armor6_id]
elsif @item.kind == 6
item1 = $data_armors[actor.armor7_id]
end
# 可以装备的情况
if actor.equippable?(@item)
# 武器的情况
if @item.is_a?(RPG::Weapon)
atk1 = item1 != nil ? item1.atk : 0
atk2 = @item != nil ? @item.atk : 0
change = atk2 - atk1
end
# 防具的情况
if @item.is_a?(RPG::Armor)
pdef1 = item1 != nil ? item1.pdef : 0
mdef1 = item1 != nil ? item1.mdef : 0
pdef2 = @item != nil ? @item.pdef : 0
mdef2 = @item != nil ? @item.mdef : 0
change = pdef2 - pdef1 + mdef2 - mdef1
end
# 描绘能力值变化
self.contents.draw_text(124, 64 + 64 * i, 112, 32,
sprintf("%+d", change), 2)
end
# 描绘物品
if item1 != nil
x = 4
y = 64 + 64 * i + 32
bitmap = RPG::Cache.icon(item1.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, item1.name)
end
end
end
end |
|