加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 金芒芒 于 2025-1-6 08:31 编辑
module Figter_data
data_id = 2
CHARACTER_NAME[data_id] = "吕布"
BASE_ATK[data_id] = 70
end
module 勋章_data
@data_id = 1
ICON[@data_id] = "icon_近卫军"
NAME[@data_id] = "近卫军"
BASE_ATK[@data_id] = 100
end
module 神器_data
@data_id = 1
ICON[@data_id] = "icon_赤月戟[鬼神]"
NAME[@data_id] = "赤月戟[鬼神]"
BASE_ATK[@data_id] = 900
end
$魏国远征军 = [
EFS_Battler.new(2),
EFS_Battler.new(4),
EFS_Battler.new(9),
EFS_Battler.new(13),
EFS_Battler.new(8)
]
class EFS_Battler < Game_Character attr_accessor :base_atk, :character_name, :勋章, :神器, :头盔, :盔甲, :战靴 attr_reader :soldier_id def initialize(data_id) super() @character_name = Figter_data::CHARACTER_NAME[data_id] @basic_character_name = @character_name @base_atk = Figter_data::BASE_ATK[data_id] @base_base_atk = @base_atk @soldier_id = data_id @勋章 = [] @神器 = [] @头盔 = [] @盔甲 = [] @战靴 = [] end def refill @base_atk = calculate_total_base_atk end def calculate_total_base_atk get_勋章_base_atk + get_神器_base_atk + get_头盔_base_atk + get_盔甲_base_atk + get_战靴_base_atk end def get_勋章_base_atk(const = false) n = const ? @base_base_atk : 0 @勋章.each do |i| n += 勋章_data::BASE_ATK[i] if i end n end def get_神器_base_atk(const = false) n = const ? @base_base_atk : 0 @神器.each do |i| n += 神器_data::BASE_ATK[i] if i end n end def get_头盔_base_atk(const = false) n = const ? @base_base_atk : 0 @头盔.each do |i| n += 头盔_data::BASE_ATK[i] if i end n end def get_盔甲_base_atk(const = false) n = const ? @base_base_atk : 0 @盔甲.each do |i| n += 盔甲_data::BASE_ATK[i] if i end n end def get_战靴_base_atk(const = false) n = const ? @base_base_atk : 0 @战靴.each do |i| n += 战靴_data::BASE_ATK[i] if i end n end # 添加装备 def add_equipment(equipment_type, equipment_id) send("#{equipment_type}_add", equipment_id) refill end # 私有方法,用于实际添加装备到对应的数组 private def 勋章_add(equipment_id) @勋章 << equipment_id end def 神器_add(equipment_id) @神器 << equipment_id end def 头盔_add(equipment_id) @头盔 << equipment_id end def 盔甲_add(equipment_id) @盔甲 << equipment_id end def 战靴_add(equipment_id) @战靴 << equipment_id end public # 更换装备 def replace_equipment(equipment_type, new_equipment_id) send("#{equipment_type}_replace", new_equipment_id) refill end # 私有方法,用于实际更换装备 private def 勋章_replace(new_equipment_id) @勋章.clear @勋章 << new_equipment_id end def 神器_replace(new_equipment_id) @神器.clear @神器 << new_equipment_id end def 头盔_replace(new_equipment_id) @头盔.clear @头盔 << new_equipment_id end def 盔甲_replace(new_equipment_id) @盔甲.clear @盔甲 << new_equipment_id end def 战靴_replace(new_equipment_id) @战靴.clear @战靴 << new_equipment_id end public # 卸除装备 def remove_equipment(equipment_type) send("#{equipment_type}_remove") refill end # 私有方法,用于实际卸除装备 private def 勋章_remove @勋章.clear end def 神器_remove @神器.clear end def 头盔_remove @头盔.clear end def 盔甲_remove @盔甲.clear end def 战靴_remove @战靴.clear end end
class EFS_Battler < Game_Character
attr_accessor :base_atk, :character_name, :勋章, :神器, :头盔, :盔甲, :战靴
attr_reader :soldier_id
def initialize(data_id)
super()
@character_name = Figter_data::CHARACTER_NAME[data_id]
@basic_character_name = @character_name
@base_atk = Figter_data::BASE_ATK[data_id]
@base_base_atk = @base_atk
@soldier_id = data_id
@勋章 = []
@神器 = []
@头盔 = []
@盔甲 = []
@战靴 = []
end
def refill
@base_atk = calculate_total_base_atk
end
def calculate_total_base_atk
get_勋章_base_atk + get_神器_base_atk + get_头盔_base_atk + get_盔甲_base_atk + get_战靴_base_atk
end
def get_勋章_base_atk(const = false)
n = const ? @base_base_atk : 0
@勋章.each do |i|
n += 勋章_data::BASE_ATK[i] if i
end
n
end
def get_神器_base_atk(const = false)
n = const ? @base_base_atk : 0
@神器.each do |i|
n += 神器_data::BASE_ATK[i] if i
end
n
end
def get_头盔_base_atk(const = false)
n = const ? @base_base_atk : 0
@头盔.each do |i|
n += 头盔_data::BASE_ATK[i] if i
end
n
end
def get_盔甲_base_atk(const = false)
n = const ? @base_base_atk : 0
@盔甲.each do |i|
n += 盔甲_data::BASE_ATK[i] if i
end
n
end
def get_战靴_base_atk(const = false)
n = const ? @base_base_atk : 0
@战靴.each do |i|
n += 战靴_data::BASE_ATK[i] if i
end
n
end
# 添加装备
def add_equipment(equipment_type, equipment_id)
send("#{equipment_type}_add", equipment_id)
refill
end
# 私有方法,用于实际添加装备到对应的数组
private
def 勋章_add(equipment_id)
@勋章 << equipment_id
end
def 神器_add(equipment_id)
@神器 << equipment_id
end
def 头盔_add(equipment_id)
@头盔 << equipment_id
end
def 盔甲_add(equipment_id)
@盔甲 << equipment_id
end
def 战靴_add(equipment_id)
@战靴 << equipment_id
end
public
# 更换装备
def replace_equipment(equipment_type, new_equipment_id)
send("#{equipment_type}_replace", new_equipment_id)
refill
end
# 私有方法,用于实际更换装备
private
def 勋章_replace(new_equipment_id)
@勋章.clear
@勋章 << new_equipment_id
end
def 神器_replace(new_equipment_id)
@神器.clear
@神器 << new_equipment_id
end
def 头盔_replace(new_equipment_id)
@头盔.clear
@头盔 << new_equipment_id
end
def 盔甲_replace(new_equipment_id)
@盔甲.clear
@盔甲 << new_equipment_id
end
def 战靴_replace(new_equipment_id)
@战靴.clear
@战靴 << new_equipment_id
end
public
# 卸除装备
def remove_equipment(equipment_type)
send("#{equipment_type}_remove")
refill
end
# 私有方法,用于实际卸除装备
private
def 勋章_remove
@勋章.clear
end
def 神器_remove
@神器.clear
end
def 头盔_remove
@头盔.clear
end
def 盔甲_remove
@盔甲.clear
end
def 战靴_remove
@战靴.clear
end
end
class EFS_Battler < Game_Character attr_accessor :base_atk, :character_name, :勋章, :神器, :头盔, :盔甲, :战靴 attr_reader :soldier_id def initialize(data_id) super() @soldier_id = data_id @character_name = Figter_data::CHARACTER_NAME[data_id] @base_atk = Figter_data::BASE_ATK[data_id] @base_base_atk = @base_atk @勋章 = [] @神器 = [] @头盔 = [] @盔甲 = [] @战靴 = [] end def refill calculate_勋章 calculate_神器 calculate_头盔 calculate_盔甲 calculate_战靴 end def calculate_勋章 @base_base_atk = get_勋章_base_atk(true) end def calculate_神器 @base_base_atk = get_神器_base_atk(true) end def calculate_头盔 @base_base_atk = get_头盔_base_atk(true) end def calculate_盔甲 @base_base_atk = get_盔甲_base_atk(true) end def calculate_战靴 @base_base_atk = get_战靴_base_atk(true) end def get_装备_base_atk(装备, const = false) n = Figter_data::BASE_ATK[@soldier_id] unless const n = @base_base_atk end 装备.each do |i| next if i.nil? n += send("#{装备.to_s.gsub('装备', '')}_data::BASE_ATK", i) end n end alias get_勋章_base_atk get_装备_base_atk alias get_神器_base_atk get_装备_base_atk alias get_头盔_base_atk get_装备_base_atk alias get_盔甲_base_atk get_装备_base_atk alias get_战靴_base_atk get_装备_base_atk def add_equipment(equipment_type, equipment_id) send("#{equipment_type}<<", equipment_id) send("calculate_#{equipment_type}") end def change_equipment(equipment_type, new_equipment_id) old_equipment_index = send("#{equipment_type}").index { |id| !id.nil? } if old_equipment_index send("#{equipment_type}[old_equipment_index]=", new_equipment_id) else send("add_equipment", equipment_type, new_equipment_id) end send("calculate_#{equipment_type}") end def remove_equipment(equipment_type) send("#{equipment_type}.clear") send("calculate_#{equipment_type}") end end
class EFS_Battler < Game_Character
attr_accessor :base_atk, :character_name, :勋章, :神器, :头盔, :盔甲, :战靴
attr_reader :soldier_id
def initialize(data_id)
super()
@soldier_id = data_id
@character_name = Figter_data::CHARACTER_NAME[data_id]
@base_atk = Figter_data::BASE_ATK[data_id]
@base_base_atk = @base_atk
@勋章 = []
@神器 = []
@头盔 = []
@盔甲 = []
@战靴 = []
end
def refill
calculate_勋章
calculate_神器
calculate_头盔
calculate_盔甲
calculate_战靴
end
def calculate_勋章
@base_base_atk = get_勋章_base_atk(true)
end
def calculate_神器
@base_base_atk = get_神器_base_atk(true)
end
def calculate_头盔
@base_base_atk = get_头盔_base_atk(true)
end
def calculate_盔甲
@base_base_atk = get_盔甲_base_atk(true)
end
def calculate_战靴
@base_base_atk = get_战靴_base_atk(true)
end
def get_装备_base_atk(装备, const = false)
n = Figter_data::BASE_ATK[@soldier_id]
unless const
n = @base_base_atk
end
装备.each do |i|
next if i.nil?
n += send("#{装备.to_s.gsub('装备', '')}_data::BASE_ATK", i)
end
n
end
alias get_勋章_base_atk get_装备_base_atk
alias get_神器_base_atk get_装备_base_atk
alias get_头盔_base_atk get_装备_base_atk
alias get_盔甲_base_atk get_装备_base_atk
alias get_战靴_base_atk get_装备_base_atk
def add_equipment(equipment_type, equipment_id)
send("#{equipment_type}<<", equipment_id)
send("calculate_#{equipment_type}")
end
def change_equipment(equipment_type, new_equipment_id)
old_equipment_index = send("#{equipment_type}").index { |id| !id.nil? }
if old_equipment_index
send("#{equipment_type}[old_equipment_index]=", new_equipment_id)
else
send("add_equipment", equipment_type, new_equipment_id)
end
send("calculate_#{equipment_type}")
end
def remove_equipment(equipment_type)
send("#{equipment_type}.clear")
send("calculate_#{equipment_type}")
end
end
|