加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 金芒芒 于 2025-1-9 13:56 编辑
根据脚本生成 魏国远征军 = [ EFS_Battler.new(2), EFS_Battler.new(4), EFS_Battler.new(9), EFS_Battler.new(13), EFS_Battler.new(8) ]
class Scene_EFS_Equip
class Window_EFS_EquipLeft < Window_Base
class Window_EFS_Selectable < Window_Base
class Window_EFS_EquipItem < Window_Selectable
class Scene_EFS_Equip
def initialize
@角色索引 = 0
@装备索引 = 0
create_windows
end
def create_windows
@left_window = Window_EFS_EquipLeft.new
@selectable_window = Window_EFS_Selectable.new
@equip_item_window = Window_EFS_EquipItem.new
end
end
class Window_EFS_EquipLeft < Window_Base
def initialize
super(0, 0, 160, Graphics.height)
refresh
end
def refresh
self.contents.clear
# 这里可以添加代码来显示左侧角色相关信息等
end
end
class Window_EFS_Selectable < Window_Base
def initialize
super(160, 0, Graphics.width - 160, Graphics.height / 2)
refresh
end
def refresh
self.contents.clear
# 这里可以添加代码来显示可选择的勋章等相关信息
end
end
class Window_EFS_EquipItem < Window_Selectable
def initialize
super(160, Graphics.height / 2, Graphics.width - 160, Graphics.height / 2)
refresh
end
def refresh
self.contents.clear
# 这里可以添加代码来显示已装备的勋章等相关信息
end
end
4. 在主脚本中使用示例
ruby
# 初始化角色数组
$魏国远征军 = [
EFS_Battler.new(2),
EFS_Battler.new(4),
EFS_Battler.new(9),
EFS_Battler.new(13),
EFS_Battler.new(8)
]
module Xunzhang_data @data_id = 0 ICON = [] NAME = [] DISCRIPTION = [] PRICE = [] TYPE = [] LIMIT = [] AMMOR_HP = [] SHD_HP = [] LIVE_CHANCE = [] MOVEMENT_SPEED = [] CRITICAL = [] BASE_ATK = [] BRO_ATK = [] S_BASE_ATK = [] S_BRO_ATK = [] ANTI_CAV = [] ANTI_INF = [] ATK_FR = [] ACCURATCY = [] ENGAGE_RANGE = [] AMMO_MAX = [] MORALE = [] def self.get_num_Xunzhang #定义自我。获得号码装备 return @data_id #返回@data_id end
module Xunzhang_data
@data_id = 0
ICON = []
NAME = []
DISCRIPTION = []
PRICE = []
TYPE = []
LIMIT = []
AMMOR_HP = []
SHD_HP = []
LIVE_CHANCE = []
MOVEMENT_SPEED = []
CRITICAL = []
BASE_ATK = []
BRO_ATK = []
S_BASE_ATK = []
S_BRO_ATK = []
ANTI_CAV = []
ANTI_INF = []
ATK_FR = []
ACCURATCY = []
ENGAGE_RANGE = []
AMMO_MAX = []
MORALE = []
def self.get_num_Xunzhang #定义自我。获得号码装备
return @data_id #返回@data_id
end
module Xunzhang_data #module Equips_data @data_id = 5 ICON[@data_id] = "icon_1280" NAME[@data_id] = "测试刀" DISCRIPTION[@data_id] = "测试用的刀,非常坚固,非常OP" PRICE[@data_id] = 999 #类型: 1.甲 2.盾 3.近战武器 4.远程武器 5.马 TYPE[@data_id] = 3 #限制:只有特定兵种才能装,nil都能装 LIMIT[@data_id] = nil #防具类, 都是加成 AMMOR_HP[@data_id] = 0 SHD_HP[@data_id] = 0 LIVE_CHANCE[@data_id] = 0 MOVEMENT_SPEED[@data_id] = 0 CRITICAL[@data_id] = 0 BASE_ATK[@data_id] = 50 BRO_ATK[@data_id] = 0 S_BASE_ATK[@data_id] = 0 S_BRO_ATK[@data_id] = 0 ANTI_CAV[@data_id] = 0 ANTI_INF[@data_id] = 0 ATK_FR[@data_id] = 0 ACCURATCY[@data_id] = 0 ENGAGE_RANGE[@data_id] = 0 AMMO_MAX[@data_id] = 0 MORALE[@data_id] = 0 end
module Xunzhang_data
#module Equips_data
@data_id = 5
ICON[@data_id] = "icon_1280"
NAME[@data_id] = "测试刀"
DISCRIPTION[@data_id] = "测试用的刀,非常坚固,非常OP"
PRICE[@data_id] = 999
#类型: 1.甲 2.盾 3.近战武器 4.远程武器 5.马
TYPE[@data_id] = 3
#限制:只有特定兵种才能装,nil都能装
LIMIT[@data_id] = nil
#防具类, 都是加成
AMMOR_HP[@data_id] = 0
SHD_HP[@data_id] = 0
LIVE_CHANCE[@data_id] = 0
MOVEMENT_SPEED[@data_id] = 0
CRITICAL[@data_id] = 0
BASE_ATK[@data_id] = 50
BRO_ATK[@data_id] = 0
S_BASE_ATK[@data_id] = 0
S_BRO_ATK[@data_id] = 0
ANTI_CAV[@data_id] = 0
ANTI_INF[@data_id] = 0
ATK_FR[@data_id] = 0
ACCURATCY[@data_id] = 0
ENGAGE_RANGE[@data_id] = 0
AMMO_MAX[@data_id] = 0
MORALE[@data_id] = 0
end
class EFS_Battler < Game_Character attr_accessor :character_name, :base_atk, :Xunzhang attr_reader :soldier_id def initialize(data_id) super() @character_name = Figter_data::CHARACTER_NAME[data_id] @base_atk = Figter_data::BASE_ATK[data_id] @base_base_atk = @base_atk @soldier_id = data_id @Xunzhang = [] end def equip_xunzhang unless @Xunzhang.include?(Xunzhang_data.get_num_Xunzhang) @Xunzhang << Xunzhang_data.get_num_Xunzhang calculate_Xunzhang end end def replace_xunzhang(new_xunzhang_id) index = @Xunzhang.index(Xunzhang_data.get_num_Xunzhang) if index @Xunzhang[index] = new_xunzhang_id else equip_xunzhang end calculate_Xunzhang end def unequip_xunzhang @Xunzhang.delete(Xunzhang_data.get_num_Xunzhang) calculate_Xunzhang end def refill calculate_Xunzhang end def calculate_Xunzhang @base_base_atk = get_Xunzhang_base_atk end def get_Xunzhang_base_atk(const = false) n = const? Figter_data::BASE_ATK[@soldier_id] : @base_base_atk @Xunzhang.each do |i| next if i.nil? n += Xunzhang_data::BASE_ATK[i] end n end end
class EFS_Battler < Game_Character
attr_accessor :character_name, :base_atk, :Xunzhang
attr_reader :soldier_id
def initialize(data_id)
super()
@character_name = Figter_data::CHARACTER_NAME[data_id]
@base_atk = Figter_data::BASE_ATK[data_id]
@base_base_atk = @base_atk
@soldier_id = data_id
@Xunzhang = []
end
def equip_xunzhang
unless @Xunzhang.include?(Xunzhang_data.get_num_Xunzhang)
@Xunzhang << Xunzhang_data.get_num_Xunzhang
calculate_Xunzhang
end
end
def replace_xunzhang(new_xunzhang_id)
index = @Xunzhang.index(Xunzhang_data.get_num_Xunzhang)
if index
@Xunzhang[index] = new_xunzhang_id
else
equip_xunzhang
end
calculate_Xunzhang
end
def unequip_xunzhang
@Xunzhang.delete(Xunzhang_data.get_num_Xunzhang)
calculate_Xunzhang
end
def refill
calculate_Xunzhang
end
def calculate_Xunzhang
@base_base_atk = get_Xunzhang_base_atk
end
def get_Xunzhang_base_atk(const = false)
n = const? Figter_data::BASE_ATK[@soldier_id] : @base_base_atk
@Xunzhang.each do |i|
next if i.nil?
n += Xunzhang_data::BASE_ATK[i]
end
n
end
end
|