Project1
标题:
二刀流脚本突然出错。
[打印本页]
作者:
爆焰
时间:
2020-6-3 20:38
标题:
二刀流脚本突然出错。
就是这个二刀流脚本一直没错的,今天突然出错了。不知道哪里出了问题。
ssss.7z
(190.13 KB, 下载次数: 34)
2020-6-3 20:38 上传
点击文件名下载附件
作者:
冷俊逸
时间:
2020-6-3 22:14
这个是不是要配合“增加显示属性数量”脚本使用
错误原因就在尝试显示8种属性,但是系统内只有3种,改了两行代码就行了。
以下覆盖原脚本即可
#在属性栏中创建或者修改一个属性的名字,命名为“二刀流”.
#==============================================================================
module Special_Settings
INJURY_VALUE = 1.5 #第二把武器伤害值
ACTIVE_ANIMATION = false #第二把武器行 动方动画 是否显示
TARGET_ANIMATION = false #第二把武器行 对象方动画 是否显示
end
class Special_Element
#--------------------------------------------------------------------------
# ● 定义特殊属性的常量
#--------------------------------------------------------------------------
TWO_WEAPONS = "二刀流"
#--------------------------------------------------------------------------
# ● 获取全部特殊属性
#--------------------------------------------------------------------------
def self.special_elements
# 列举所有特殊属性
elements = [
TWO_WEAPONS
]
return elements
end
#--------------------------------------------------------------------------
# ● 从属性名获得该属性的ID
#--------------------------------------------------------------------------
def self.get_index(name)
return $data_system.elements.index(name)
end
#--------------------------------------------------------------------------
# ● 获得匹配正则表达式的所有属性的ID和匹配信息
# 返回值:二维阵列[n][0]中的ID,[n][1]中的匹配信息(MatchData)
#--------------------------------------------------------------------------
def self.get_indices(regexp)
indices = []
for i in 1...$data_system.elements.size
indices.push([i, $~]) if regexp =~ $data_system.elements[i]
end
end
#--------------------------------------------------------------------------
# ● 删除特殊属性
# element_set : 删除之前的属性ID排列
# ignore_elements : 可用要删除的属性ID、名称、正则表达式指定
# 返回值 : 删除结果的属性ID排列
#--------------------------------------------------------------------------
def self.delete(element_set)
result = element_set.dup
for ignore in Special_Element::special_elements
case ignore
when Integer
result.delete(ignore)
when String
result.delete(Special_Element::get_index(ignore))
when Regexp
for i in result
result[i] = nil if ignore =~ $data_system.elements[result[i]]
end
result.delete(nil)
end
end
return result
end
end
class Game_Battler
#--------------------------------------------------------------------------
# ● 属性校正计算
# element_set : 属性
#--------------------------------------------------------------------------
def elements_correct(element_set)
# --- 更改部分 ---
element_set = Special_Element::delete(element_set)
# --- 完成修改 ---
# 无属性的情况
if element_set == []
# 100 返回
return 100
end
# 返回给定的属性中最弱的属性
# ※方法element_rate是从该类继承的Game_Actor
# 以及Game_Enemy类中定义的
weakest = -100
for i in element_set
weakest = [weakest, self.element_rate(i)].max
end
return weakest
end
end
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 公开实例变量
#--------------------------------------------------------------------------
attr_reader :name # 名前
attr_reader :character_name # 角色文件名
attr_reader :character_hue # 角色 色相
attr_reader :class_id # 类别 ID
attr_reader :weapon_id # 武器 ID
# --- 从这里追加部分 ---
attr_reader :weapon2_id # 二刀流武器 ID
# --- 添加部分结束 ---
attr_reader :armor1_id # 盾 ID
attr_reader :armor2_id # 頭防具 ID
attr_reader :armor3_id # 体防具 ID
attr_reader :armor4_id # 装飾品 ID
attr_reader :level # 级别
attr_reader :exp # EXP
attr_reader :skills # 技能
#--------------------------------------------------------------------------
# ● 设置
# actor_id : 角色 ID
#--------------------------------------------------------------------------
def setup(actor_id)
actor = $data_actors[actor_id]
@actor_id = actor_id
@name = actor.name
@character_name = actor.character_name
@character_hue = actor.character_hue
@battler_name = actor.battler_name
@battler_hue = actor.battler_hue
@class_id = actor.class_id
@weapon_id = actor.weapon_id
# --- 从这里追加部分 ---
@weapon2_id = 0
@weapon2_id = 1 if actor_id ==1
# --- 添加部分结束 ---
@armor1_id = actor.armor1_id
@armor2_id = actor.armor2_id
@armor3_id = actor.armor3_id
@armor4_id = actor.armor4_id
@level = actor.initial_level
@exp_list = Array.new(101)
make_exp_list
@exp = @exp_list[@level]
@skills = []
@hp = maxhp
@sp = maxsp
@states = []
@states_turn = {}
@maxhp_plus = 0
@maxsp_plus = 0
@str_plus = 0
@dex_plus = 0
@agi_plus = 0
@int_plus = 0
# 技能学习
for i in 1..@level
for j in $data_classes[@class_id].learnings
if j.level == i
learn_skill(j.skill_id)
end
end
end
# 更新自动状态
update_auto_state(nil, $data_armors[@armor1_id])
update_auto_state(nil, $data_armors[@armor2_id])
update_auto_state(nil, $data_armors[@armor3_id])
update_auto_state(nil, $data_armors[@armor4_id])
end
#--------------------------------------------------------------------------
# ● 获取普通攻击属性
#--------------------------------------------------------------------------
def element_set
weapon = $data_weapons[@weapon_id]
# ---从这里开始变更部分---
weapon2 = $data_weapons[@weapon2_id]
result = []
result.concat(weapon.element_set) if weapon != nil
result.concat(weapon2.element_set) if weapon2 != nil
return result
# ---修改部分结束---
end
#--------------------------------------------------------------------------
# ● 获取普通攻击状态变化 (+)
#--------------------------------------------------------------------------
def plus_state_set
weapon = $data_weapons[@weapon_id]
# ---从这里开始变更部分---
weapon2 = $data_weapons[@weapon2_id]
result = []
result.concat(weapon.plus_state_set) if weapon != nil
result.concat(weapon2.plus_state_set) if weapon2 != nil
return result
# ---修改部分结束---
end
#--------------------------------------------------------------------------
# ● 获取普通攻击状态变化 (-)
#--------------------------------------------------------------------------
def minus_state_set
weapon = $data_weapons[@weapon_id]
# ---从这里开始变更部分---
weapon2 = $data_weapons[@weapon2_id]
result = []
result.concat(weapon.minus_state_set) if weapon != nil
result.concat(weapon2.minus_state_set) if weapon2 != nil
return result
# ---修改部分结束---
end
#--------------------------------------------------------------------------
# ● 获取基本力量
#--------------------------------------------------------------------------
def base_str
n = $data_actors[@actor_id].parameters[2, @level] #某个角色级别自身力量
weapon = $data_weapons[@weapon_id] #武器所含力量
armor1 = $data_armors[@armor1_id] #防具1所含力量
armor2 = $data_armors[@armor2_id] #防具2所含力量
armor3 = $data_armors[@armor3_id] #防具3所含力量
armor4 = $data_armors[@armor4_id] #防具4所含力量
# ---从这里开始追加部分---
weapon2 = $data_weapons[@weapon2_id]
# 就那样加在一起的话太强了所以试着减半的测试
n += weapon2 != nil ? weapon2.str_plus / Special_Settings::INJURY_VALUE : 0
# ---追加部分结束---
n += weapon != nil ? weapon.str_plus : 0
n += armor1 != nil ? armor1.str_plus : 0
n += armor2 != nil ? armor2.str_plus : 0
n += armor3 != nil ? armor3.str_plus : 0
n += armor4 != nil ? armor4.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 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
# --- 从这里开始追加部分 ---
weapon2 = $data_weapons[@weapon2_id]
# 就那样加在一起的话太强了所以试着减半的测试
n += weapon2 != nil ? weapon2.dex_plus / Special_Settings::INJURY_VALUE : 0
# --- 追加部分结束 ---
n += weapon != nil ? weapon.dex_plus : 0
n += armor1 != nil ? armor1.dex_plus : 0
n += armor2 != nil ? armor2.dex_plus : 0
n += armor3 != nil ? armor3.dex_plus : 0
n += armor4 != nil ? armor4.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 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
# --- 从这里追加部分 ---
weapon2 = $data_weapons[@weapon2_id]
# 就那样加在一起的话太强了所以试着减半的测试
n += weapon2 != nil ? weapon2.agi_plus / Special_Settings::INJURY_VALUE : 0
# --- 添加部分结束 ---
n += weapon != nil ? weapon.agi_plus : 0
n += armor1 != nil ? armor1.agi_plus : 0
n += armor2 != nil ? armor2.agi_plus : 0
n += armor3 != nil ? armor3.agi_plus : 0
n += armor4 != nil ? armor4.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 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
# --- 从这里追加部分 ---
weapon2 = $data_weapons[@weapon2_id]
# 就那样加在一起的话太强了所以试着减半的测试
n += weapon2 != nil ? weapon2.int_plus / Special_Settings::INJURY_VALUE : 0
# --- 添加部分结束 ---
n += weapon != nil ? weapon.int_plus : 0
n += armor1 != nil ? armor1.int_plus : 0
n += armor2 != nil ? armor2.int_plus : 0
n += armor3 != nil ? armor3.int_plus : 0
n += armor4 != nil ? armor4.int_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本攻击力
#--------------------------------------------------------------------------
def base_atk
weapon = $data_weapons[@weapon_id]
# --- 更改部分 ---
weapon2 = $data_weapons[@weapon2_id]
# 就那样加在一起的话太强了所以试着减半的测试
n = weapon2 != nil ? weapon2.atk / 2:0 #Special_Settings::INJURY_VALUE : 0
return weapon != nil ? weapon.atk + n : n
# --- 完成修改 ---
end
#--------------------------------------------------------------------------
# ● 获取基本物理防御
#--------------------------------------------------------------------------
def base_pdef
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
pdef1 = weapon != nil ? weapon.pdef : 0
pdef2 = armor1 != nil ? armor1.pdef : 0
pdef3 = armor2 != nil ? armor2.pdef : 0
pdef4 = armor3 != nil ? armor3.pdef : 0
pdef5 = armor4 != nil ? armor4.pdef : 0
# --- 从这里追加部分 ---
weapon2 = $data_weapons[@weapon2_id]
# 就那样加在一起的话太强了所以试着减半的测试
pdef1 += weapon2 != nil ? weapon2.pdef / Special_Settings::INJURY_VALUE : 0
# --- 添加部分结束 ---
return pdef1 + pdef2 + pdef3 + pdef4 + pdef5
end
#--------------------------------------------------------------------------
# ● 获取基本魔法防御
#--------------------------------------------------------------------------
def base_mdef
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
mdef1 = weapon != nil ? weapon.mdef : 0
mdef2 = armor1 != nil ? armor1.mdef : 0
mdef3 = armor2 != nil ? armor2.mdef : 0
mdef4 = armor3 != nil ? armor3.mdef : 0
mdef5 = armor4 != nil ? armor4.mdef : 0
# --- 从这里追加部分 ---
weapon2 = $data_weapons[@weapon2_id]
# 就那样加在一起的话太强了所以试着减半的测试
mdef1 += weapon2 != nil ? weapon2.mdef / Special_Settings::INJURY_VALUE : 0
# --- 添加部分结束 ---
return mdef1 + mdef2 + mdef3 + mdef4 + mdef5
end
#--------------------------------------------------------------------------
# ● 普通攻击 获取攻击方动画 ID
#--------------------------------------------------------------------------
def animation1_id
weapon = $data_weapons[@weapon_id]
# --- 更改部分 ---
weapon2 = $data_weapons[@weapon2_id]
animations = []
animations.push(weapon.animation1_id) if weapon != nil
animations.push(weapon2.animation1_id) if weapon2 != nil and Special_Settings::ACTIVE_ANIMATION
animations.delete(0)
return animations.empty? ? 0 : animations
# --- 完成修改 ---
end
#--------------------------------------------------------------------------
# ● 普通攻击 获取对像方动画 ID
#--------------------------------------------------------------------------
def animation2_id
weapon = $data_weapons[@weapon_id]
# --- 更改部分 ---
weapon2 = $data_weapons[@weapon2_id]
animations = []
animations.push(weapon.animation2_id) if weapon != nil
animations.push(weapon2.animation2_id) if weapon2 != nil and Special_Settings::TARGET_ANIMATION
animations.delete(0)
return animations.empty? ? 0 : animations
# --- 完成修改 ---
end
#--------------------------------------------------------------------------
# ● 装备固定判定
# equip_type : 装备类型(变更点:-1是二刀流的盾部分的武器
# 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)
# --- 从这里追加部分 ---
# 装备不是二刀武器的东西,取下盾的部分二刀武器
if id != 0 and !$data_weapons[id].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
$game_party.gain_weapon(@weapon2_id, 1)
@weapon2_id = 0
end
# --- 添加部分结束 ---
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)
# --- 从这里追加部分 ---
# 装备二刀武器时取下
if id != 0
$game_party.gain_weapon(@weapon2_id, 1)
@weapon2_id = 0
end
# --- 添加部分结束 ---
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 -1 # 二刀流盾部分的武器
if id == 0 or $game_party.weapon_number(id) > 0
$game_party.gain_weapon(@weapon2_id, 1)
@weapon2_id = id
$game_party.lose_weapon(id, 1)
# 取下盾牌
$game_party.gain_armor(@armor1_id, 1)
@armor1_id = 0
# 已经装备的武器不是二刀武器的情况除外
if id != 0 and @weapon_id != 0 and !$data_weapons[@weapon_id].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
$game_party.gain_weapon(@weapon_id, 1)
@weapon_id = 0
end
end
# --- 添加部分结束 ---
end
end
#--------------------------------------------------------------------------
# ● 是否可以二刀流的角色
#--------------------------------------------------------------------------
def can_two_weapons?
return class_element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
end
#--------------------------------------------------------------------------
# ● 角色类属性获取A类属性
#--------------------------------------------------------------------------
def class_element_set
element_set = []
for i in 1...$data_classes[@class_id].element_ranks.xsize
element_set.push(i) if $data_classes[@class_id].element_ranks[i] == 1
end
return element_set
end
end
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = []
@data.push($data_weapons[@actor.weapon_id])
# --- 更改部分 ---
@data.push(@actor.weapon2_id != 0 ? $data_weapons[@actor.weapon2_id] : $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])
@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(5, 32 * 4, 92, 32, $data_system.words.armor4)
draw_item_name(@data[0], 92, 32 * 0)
draw_item_name(@data[1], 92, 32 * 1)
draw_item_name(@data[2], 92, 32 * 2)
draw_item_name(@data[3], 92, 32 * 3)
draw_item_name(@data[4], 92, 32 * 4)
end
end
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# 添加可以装备的武器
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
@data.push($data_weapons[i])
end
end
end
# --- 从这里添加部分 ---
# 装备部位是盾的位置,可以二刀流的角色
if @equip_type == 1 and @actor.can_two_weapons?
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) and $data_weapons[i].element_set.include?(Special_Element::get_index(Special_Element::TWO_WEAPONS))
@data.push($data_weapons[i])
end
end
end
# --- 添加部分结束 ---
# 添加可以装备的防具
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1
@data.push($data_armors[i])
end
end
end
end
# 添加空白
@data.push(nil)
# 创建位图,绘制所有项目
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max-1
draw_item(i)
end
end
end
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)
end
# 物品窗口被激活的情况下
if @item_window.active
# 获取现在选中的物品
item2 = @item_window.item
# 变更装备
last_hp = @actor.hp
last_sp = @actor.sp
# --- 更改部分 ---
# 保存当前装备(增加装备种类时更改此处)
equipments = [@actor.weapon2_id, @actor.weapon_id, @actor.armor1_id, @actor.armor2_id, @actor.armor3_id, @actor.armor4_id]
# ★★★★★★★★★★★★★★★★---更改部分 ---★★★★★★★★★★★★★★★★
index = equip_type(@right_window.index, item2)
@actor.equip((index == -1 ? index : index.abs), item2 == nil ? 0 : item2.id)
# ★★★★★★★★★★★★★★★★---更改完成 ---★★★★★★★★★★★★★★★★
# equip(装备类型,武器ID)
#● 装备固定判定
#● equip_type : 装备类型(变更点:-1是二刀流的盾部分的武器
#● id : 武器 or 防具 ID (0 装备解除)
#● #如果是-1,则保持不变,其他情况取绝对值,
#● item2 物品栏id为nil,代表替换的是空白武器,则用0号ID,不是空的话则替换对应武器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
# --- 更改部分 ---
# 返回到装备
for i in 0...equipments.size
@actor.equip(i - 1, equipments[i])
end
# --- 完成修改 ---
@actor.hp = last_hp
@actor.sp = last_sp
# 描画左窗口
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (物品窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_item
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 取消演奏SE
$game_system.se_play($data_system.cancel_se)
# 激活右侧窗口
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
# C按下按钮时
if Input.trigger?(Input::C)
# 演奏装备SE
$game_system.se_play($data_system.equip_se)
# 获取物品窗口现在选择的装备数据
item = @item_window.item
# --- 更改部分 ---
# ★★★★★★★★★★★★★★★★---更改部分 ---★★★★★★★★★★★★★★★★
index = equip_type(@right_window.index, item)
@actor.equip((index == -1 ? index : index.abs), item == nil ? 0 : item.id)
# ★★★★★★★★★★★★★★★★---更改完成 ---★★★★★★★★★★★★★★★★
# 激活右侧窗口
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# 再生成右侧窗口、物品窗口的内容
@right_window.refresh
# --- 更改部分 ---
# 因为太麻烦了,所以刷新所有窗口
@item_window1.refresh
@item_window2.refresh
@item_window3.refresh
@item_window4.refresh
@item_window5.refresh
# --- 完成修改 ---
return
end
end
# --- 从这里追加部分 ---
#--------------------------------------------------------------------------
# ● 二刀流用的装备部位取得
#--------------------------------------------------------------------------
def equip_type(index, item)
#p item.is_a?(RPG::Armor) #如果是空的item,则是-1*index,所以造成无法卸载了。
return index * (item.is_a?(RPG::Armor) ? 1 : -1)
end
# --- 添加部分结束 ---
end
class Scene_Battle
#--------------------------------------------------------------------------
# ● 生成基本行动结果
#--------------------------------------------------------------------------
def make_basic_action_result
# 攻击的情况下
if @active_battler.current_action.basic == 0
# ★★★★★★★★★★★★★★★★---更改部分 ---★★★★★★★★★★★★★★★★
# 设置攻击 ID
@animation1_id = @active_battler.animation1_id.is_a?(Array) ? @active_battler.animation1_id.dup : @active_battler.animation1_id
@animation2_id = @active_battler.animation2_id.is_a?(Array) ? @active_battler.animation2_id.dup : @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]
# 应用通常攻击效果
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
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合步骤 3 : 行动方动画)
#--------------------------------------------------------------------------
def update_phase4_step3
# ★★★★★★★★★★★★★★★★---更改部分 ---★★★★★★★★★★★★★★★★
# 开始动画排列
if @animation1_id.is_a?(Integer)
@animation1_id = [@animation1_id]
end
animation = @animation1_id.shift
# 行动方动画 (ID 为 0 的情况下是白色闪烁)
if animation == 0
@active_battler.white_flash = true
else
@active_battler.animation_id = animation
@active_battler.animation_hit = true
end
# 动画丢失后移至步骤4
@phase4_step = 4 if @animation1_id.empty?
# ★★★★★★★★★★★★★★★★---完成修改 ------★★★★★★★★★★★★★★★
end
#--------------------------------------------------------------------------
# ● 刷新画面 (主回合步骤 4 : 对像方动画)
#--------------------------------------------------------------------------
def update_phase4_step4
# ★★★★★★★★★★★★★★★★---更改部分 ---★★★★★★★★★★★★★★★★
# 开始动画排列
if @animation2_id.is_a?(Integer)
@animation2_id = [@animation2_id]
end
animation = @animation2_id.shift
# 对像方动画
for target in @target_battlers
target.animation_id = animation
target.animation_hit = (target.damage != "Miss")
end
# 不管动画长度如何,至少等8帧
@wait_count = 8
# 动画丢失后移至步骤5
@phase4_step = 5 if @animation2_id.empty?
# ★★★★★★★★★★★★★★★★---完成修改 ------★★★★★★★★★★★★★★★
end
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1