Project1
标题:
多秒技能
[打印本页]
作者:
qq524780013
时间:
2015-6-28 00:26
标题:
多秒技能
求多秒技能的脚本
作者:
邪月长啸
时间:
2015-6-29 12:39
# ▽△▽ XRXS.付加属性名称判定 ▽△▽ built 091221
# by 桜雅 在土
#==============================================================================
# --- XRXS. 付加属性名称判定モジュール ---
#==============================================================================
module XRXS
#--------------------------------------------------------------------------
# ○ 配列が指定名の属性を持つか判定
#--------------------------------------------------------------------------
def XRXS.element_check(set, element_name)
returnar = [false, 0, 0, []] # 存在したか?, 固定値の合計、%値の合計
return returnar if !set.is_a?(Array) or set.size == 0 or element_name == ""
for i in set
if $data_system.elements[i] =~ /^#{element_name}([+-]?[0-9]+)?(%)?/
returnar[0] = true
if $2 == nil
returnar[1] += $1.to_i
returnar[3].push($1.to_i)
else
returnar[2] += $1.to_i
end
end
end
return returnar
end
def XRXS.element_include?(set, element_name)
return element_check(set, element_name)[0]
end
def XRXS.element_amount(set, element_name)
return element_check(set, element_name)[1]
end
def XRXS.element_percent(set, element_name)
return element_check(set, element_name)[2]
end
def XRXS.element_numbers(set, element_name)
return element_check(set, element_name)[3]
end
end
复制代码
# ▽△▽ XRXS. 装備属性取得機構 ▽△▽ built 221114
# by 桜雅 在土
#==============================================================================
# --- XRXS. 装備属性取得機構 ---
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ○ スキルの属性取得
#--------------------------------------------------------------------------
def skill_element_set(skill)
return skill.nil? ? [] : skill.element_set
end
#--------------------------------------------------------------------------
# ○ 全装備の属性取得
#--------------------------------------------------------------------------
def equip_element_set
return self.element_set + self.guard_element_set
end
#--------------------------------------------------------------------------
# ○ 全防具の属性取得
#--------------------------------------------------------------------------
def guard_element_set
return []
end
end
class Game_Actor < Game_Battler
def guard_element_set
set = []
for id in self.armor_ids
next if id.nil?
armor = $data_armors[id]
set += (armor != nil ? armor.guard_element_set : [])
end
return set
end
#--------------------------------------------------------------------------
# ○ 武器 ID配列
#--------------------------------------------------------------------------
def weapon_ids
@weapon_ids = [] if @weapon_ids == nil
@weapon_ids[0] = @weapon_id
return @weapon_ids
end
#--------------------------------------------------------------------------
# ○ 防具 ID配列
#--------------------------------------------------------------------------
def armor_ids
@armor_ids = [] if @armor_ids == nil
@armor_ids[0] = @armor1_id
@armor_ids[1] = @armor2_id
@armor_ids[2] = @armor3_id
@armor_ids[3] = @armor4_id
return @armor_ids
end
#--------------------------------------------------------------------------
# ○ 装備配列の取得
#--------------------------------------------------------------------------
def equipments
equipments = []
self.weapon_ids.each {|id| equipments.push($data_weapons[id])}
self.armor_ids.each {|id| equipments.push($data_armors[id])}
return equipments
end
#--------------------------------------------------------------------------
# ○ 装備中?
#--------------------------------------------------------------------------
def equiping?(item)
case item
when RPG::Weapon
return self.weapon_ids.include?(item.id)
when RPG::Armor
return self.armor_ids.include?(item.id)
else
return false
end
end
end
复制代码
# ▼▲▼ XRXS38. 属性修正计算数限制 ▼▲▼ built 081012
# by 桜雅 在土 (原作)
# Tetra-Z (強化)
#==============================================================================
# 简介:此脚本会将“系统默认的属性修正”和“战斗特殊效果属性”分开计算;
# 插入此脚本后,“战斗特殊效果属性”将“不计算属性有效度”。
#==============================================================================
# □ カスタマイズポイント
#==============================================================================
module XRXS38
# 属性的限制数量
ELEMENTS_NUMBER_LIMIT = 16
# 属性修正的计算方法
# 0 : 最大(默认的计算方法)
# 1 : 乘法
# 2 : 平均
# 3 : 最小
ELEMENT_CORRECT_METHOD = 1
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 属性修正的计算 + 倍率计算公式
#--------------------------------------------------------------------------
alias xrxs38_elements_correct elements_correct
def elements_correct(element_set)
elements = element_set.dup
# 属性数量的限制
for element_id in element_set
if element_id >XRXS38:: ELEMENTS_NUMBER_LIMIT
elements.delete(element_id)
end
end
#无属性的场合返回100
return 100 if elements.size == 0
#
case XRXS38::ELEMENT_CORRECT_METHOD
when 0 # 最大
return xrxs38_elements_correct(elements)
when 1 # 乘法
result = 100.0
minus_enable = false
for i in elements
n = self.element_rate(i)
minus_enable |= (n < 0)
result *= n / 100.0
end
result = -1 * result.abs if minus_enable
return result.to_i
when 2 # 平均
rates = []
result = 0
for i in elements
rates.push(self.element_rate(i))
end
for rate in rates
result += rate
end
return result / rates.size
when 3 # 最小
for i in elements
n = self.element_rate(i)
result = n if result.nil? or result > n
end
return result
end
end
end
复制代码
#==============================================================================
#[仿大话梦幻]多体攻击(俗称秒2~秒7,非全体攻击)Ver0.03b
#
#by SixRice = 66fan
#==============================================================================
#适用战斗系统:默认回合制,CP半即时;RTAB不适用
#
#很简单的脚本,不推荐作为外挂脚本来用。希望大家能看懂之后添加近自己的游戏中去。
#
#重定义部分:set_target_battlers,其余为新定义。
#
#上面三个XRXS的脚本不要删除,请尊重别人的版权。
#
#Ver0.03根据玩家的建议,追加范围变成按照对象的速度排序。
#
#Ver0.02新增随机范围
# 修正0.01中,如果什么范围都不选,会变成全体攻击的BUG
#
#==============================================================================
# 使用说明:
#1,单体目标的情况下,以下秒几的效果为追加范围
#2,全体目标的情况下,以下秒几的效果为固定范围
#3,如果附加了“随机”属性,
# 单体攻击追加范围变成 0 到 X,
# 全体攻击固定范围变成 1 到 X,
# 举例:单体攻击,追加范围“秒7”,“随机”,实际范围是 1 +(0 ~ 7)
# 全体攻击,固定范围“秒8”,“随机”,实际范围是 1 ~ 8
#
# 如有其他特殊要求,请看懂脚本自行设置。
#==============================================================================
module SXR
#==============================================================================
#属性名(同时存在的话,取最大值;同时包括多体范围和随机范围的话,取随机范围。)
#==============================================================================
ADD_TARGET2 = "秒2"#1体目标,追加1体序列
ADD_TARGET3 = "秒3"#1体目标,追加2体序列
ADD_TARGET4 = "秒4"#1体目标,追加3体序列
ADD_TARGET5 = "秒5"#1体目标,追加4体序列
ADD_TARGET6 = "秒6"#1体目标,追加5体序列
ADD_TARGET7 = "秒7"#1体目标,追加6体序列
ADD_TARGET8 = "秒8"#1体目标,追加7体序列
ARA_TARGET = "随机"#单选无效,配合上面才能产生效果,将追加改为随机追加
end
#==============================================================================
# ■ Game_BattleAction
#==============================================================================
class Game_BattleAction
attr_accessor :add_target
attr_accessor :ara_target
#------------------------------------------------------------------------------
# ○ clear
#------------------------------------------------------------------------------
alias sxr_clear clear
def clear
sxr_clear
clear_sxr_add_target
end
#------------------------------------------------------------------------------
# ○ 特殊效果clear
#------------------------------------------------------------------------------
def clear_sxr_add_target
self.add_target = 0
self.ara_target = 0
end
#------------------------------------------------------------------------------
# ○ 无效化特殊效果
#------------------------------------------------------------------------------
def nillize_sxr_add_target
self.add_target = nil
self.ara_target = nil
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
#------------------------------------------------------------------------------
# ○追加目标范围设定
#------------------------------------------------------------------------------
def set_sxr_add_target(set)
# 追加/固定目标范围强制值
self.current_action.add_target =
XRXS.element_include?(set, SXR::ADD_TARGET8) ? 8 :
XRXS.element_include?(set, SXR::ADD_TARGET7) ? 7 :
XRXS.element_include?(set, SXR::ADD_TARGET6) ? 6 :
XRXS.element_include?(set, SXR::ADD_TARGET5) ? 5 :
XRXS.element_include?(set, SXR::ADD_TARGET4) ? 4 :
XRXS.element_include?(set, SXR::ADD_TARGET3) ? 3 :
XRXS.element_include?(set, SXR::ADD_TARGET2) ? 2 :
0
# 是否随机目标范围
self.current_action.ara_target =
XRXS.element_include?(set, SXR::ARA_TARGET) ? 1 :
0
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
alias sxr_main main
def main
# recall
sxr_main
# 清空角色的特殊效果设置
for actor in $game_party.actors
actor.current_action.clear_sxr_add_target
actor.current_action.nillize_sxr_add_target
end
end
#--------------------------------------------------------------------------
# ● 设置物品或特技对像方的战斗者
# scope : 特技或者是物品的范围
#--------------------------------------------------------------------------
def set_target_battlers(scope)
# 行动方的战斗者是敌人的情况下
if @active_battler.is_a?(Game_Enemy)
# 效果范围分支
case scope
when 1 # 敌单体
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
end
end
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
@target_battlers.delete($game_party.smooth_target_actor(index))
@target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
@target_battlers = @target_battlers[0, 0] if @active_battler.current_action.add_target == 0
@target_battlers = @target_battlers[0, 1] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
@target_battlers.push($game_party.smooth_target_actor(index))
when 2 # 敌全体
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
@target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
end
end
when 3 # 我方单体
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
@target_battlers.delete($game_troop.smooth_target_enemy(index))
@target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
@target_battlers = @target_battlers[0, 0] if @active_battler.current_action.add_target == 0
@target_battlers = @target_battlers[0, 1] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 4 # 我方全体
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
@target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
end
end
when 5 # 我方单体 (HP 0)
index = @active_battler.current_action.target_index
enemy = $game_troop.enemies[index]
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
when 6 # 我方全体 (HP 0)
for enemy in $game_troop.enemies
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
@target_battlers.sort! {|a,b| b.agi - a.agi } #(0.03)
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
end
end
when 7 # 使用者
@target_battlers.push(@active_battler)
end
end
# 行动方的战斗者是角色的情况下
if @active_battler.is_a?(Game_Actor)
@active_battler.set_sxr_add_target(@active_battler.skill_element_set(@skill))
# 效果范围分支
case scope
when 1 # 敌单体
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
@target_battlers.delete($game_troop.smooth_target_enemy(index))
@target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
@target_battlers = @target_battlers[0, 0] if @active_battler.current_action.add_target == 0
@target_battlers = @target_battlers[0, 1] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 2 # 敌全体
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
@target_battlers.sort! {|a,b| b.agi - a.agi } #(0.03)
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
end
end
when 3 # 我方单体
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
end
end
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
@target_battlers.delete($game_party.smooth_target_actor(index))
@target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
@target_battlers = @target_battlers[0, 0] if @active_battler.current_action.add_target == 0
@target_battlers = @target_battlers[0, 1] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
@target_battlers.push($game_party.smooth_target_actor(index))
when 4 # 我方全体
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
@target_battlers.sort! {|a,b| b.agi - a.agi }#(0.03)
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
end
end
when 5 # 我方单体 (HP 0)
index = @active_battler.current_action.target_index
actor = $game_party.actors[index]
if actor != nil and actor.hp0?
@target_battlers.push(actor)
end
when 6 # 我方全体 (HP 0)
for actor in $game_party.actors
if actor != nil and actor.hp0?
@target_battlers.push(actor)
@target_battlers.sort! {|a,b| b.agi - a.agi } #(0.03)
@target_battlers = @target_battlers[0, 2] if @active_battler.current_action.add_target == 2
@target_battlers = @target_battlers[0, 3] if @active_battler.current_action.add_target == 3
@target_battlers = @target_battlers[0, 4] if @active_battler.current_action.add_target == 4
@target_battlers = @target_battlers[0, 5] if @active_battler.current_action.add_target == 5
@target_battlers = @target_battlers[0, 6] if @active_battler.current_action.add_target == 6
@target_battlers = @target_battlers[0, 7] if @active_battler.current_action.add_target == 7
@target_battlers = @target_battlers[0, 8] if @active_battler.current_action.add_target == 8
@target_battlers = @target_battlers[0, rand(@active_battler.current_action.add_target)+1] if @active_battler.current_action.ara_target == 1 and @active_battler.current_action.add_target >= 2
end
end
when 7 # 使用者
@target_battlers.push(@active_battler)
end
end
end
#--------------------------------------------------------------------------
# ● 生成特技行动结果
#--------------------------------------------------------------------------
alias sxr_make_skill_action_result make_skill_action_result
def make_skill_action_result
# 获取特技
@skill = $data_skills[@active_battler.current_action.skill_id]
# 获取行动者特技附加的战斗特效
@active_battler.set_sxr_add_target(@active_battler.skill_element_set(@skill))
# recall
sxr_make_skill_action_result
end
end
复制代码
感觉有点多、、、、
4个要一起用才可以~
作者:
白鬼
时间:
2015-7-1 23:44
本帖最后由 白鬼 于 2015-7-1 23:45 编辑
楼上手快。有一个简化的版本,一个独立脚本。在脚本中设置,不用占用数据库了
楼主可以尝试一下
多秒技能脚本
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1