Project1
标题:
如果做一个装备装备上给角色加一些状态的效果?
[打印本页]
作者:
白色幸福
时间:
2019-3-6 15:02
标题:
如果做一个装备装备上给角色加一些状态的效果?
比如说,我这个装备叫做X宝石,然后装备这个的时候角色获得状态栏里的一个状态X?
搜索没搜到类似的,可能是我不知道关键词吧
作者:
Nil2018
时间:
2019-5-25 23:43
脚本汉化合集里找
#==============================================================================
#
# ▼ Yanfly Engine Ace - 被动状态 v1.02
# -- 最后更新: 2012.01.23
# -- 使用难度: 简单
# -- 需要脚本: 无
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-PassiveStates"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.23 - Compatibility Update: Doppelganger
# 2012.01.08 - Added passive state checks for adding/removing states.
# 2011.12.14 - Started Script and Finished.
#
#==============================================================================
# ▼ 介绍
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 本脚本可以使角色/职业/武器/护甲/敌人拥有被动状态的效果.
# 被动状态在任何时候都会生效。在对象死亡后被动状态全部会自动解除,当对象被复活
# 时,被动状态会自动重新附加到其身上.
#
#==============================================================================
# ▼ 安装方式
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
# 脚本页/槽中.记得保存你的工程以使脚本生效.
#
# -----------------------------------------------------------------------------
# 角色备注 - 在数据库-角色中可以使用的备注.
# -----------------------------------------------------------------------------
# <被动状态: x>
# <被动状态: x, x>
# 使x号始终附加在该角色身上(除非角色死亡).
#
# -----------------------------------------------------------------------------
# 职业备注 - 在数据库-职业中可以使用的备注.
# -----------------------------------------------------------------------------
# <被动状态: x>
# <被动状态: x, x>
# 使x号始终附加在该职业的角色身上(除非角色死亡).
#
# -----------------------------------------------------------------------------
# 武器备注 - 在数据库-武器中可以使用的备注.
# -----------------------------------------------------------------------------
# <被动状态: x>
# <被动状态: x, x>
# 使x号始终附加在装备该武器的角色身上(除非角色死亡).
#
# -----------------------------------------------------------------------------
# 护甲备注 - 在数据库-护甲中可以使用的备注.
# -----------------------------------------------------------------------------
# <被动状态: x>
# <被动状态: x, x>
# 使x号始终附加在装备该护甲的角色身上(除非角色死亡).
#
# -----------------------------------------------------------------------------
# 敌人备注 - 在数据库-敌人中可以使用的备注.
# -----------------------------------------------------------------------------
# <被动状态: x>
# <被动状态: x, x>
# 使x号始终附加在该敌人身上(除非敌人死亡).
#
#==============================================================================
# ▼ 兼容性
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
#
#==============================================================================
# ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
# 所以编辑了后果自负。
#==============================================================================
module YEA
module REGEXP
module BASEITEM
PASSIVE_STATE =
/<(?:PASSIVE_STATE|被动状态):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
end # BASEITEM
end # REGEXP
end # YEA
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_pst load_database; end
def self.load_database
load_database_pst
load_notetags_pst
end
#--------------------------------------------------------------------------
# new method: load_notetags_pst
#--------------------------------------------------------------------------
def self.load_notetags_pst
groups = [$data_actors, $data_classes, $data_weapons, $data_armors,
$data_enemies]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_pst
end
end
end
end # DataManager
#==============================================================================
# ■ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :passive_states
#--------------------------------------------------------------------------
# common cache: load_notetags_pst
#--------------------------------------------------------------------------
def load_notetags_pst
@passive_states = []
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::BASEITEM::PASSIVE_STATE
$1.scan(/\d+/).each { |num|
@passive_states.push(num.to_i) if num.to_i > 0 }
#---
end
} # self.note.split
#---
end
end # RPG::BaseItem
#==============================================================================
# ■ Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# alias method: state?
#--------------------------------------------------------------------------
alias game_battlerbase_state_check_pst state?
def state?(state_id)
return true if passive_state?(state_id)
return game_battlerbase_state_check_pst(state_id)
end
#--------------------------------------------------------------------------
# alias method: states
#--------------------------------------------------------------------------
alias game_battlerbase_states_pst states
def states
array = game_battlerbase_states_pst
array |= passive_states
return array
end
#--------------------------------------------------------------------------
# new method: passive_state?
#--------------------------------------------------------------------------
def passive_state?(state_id)
@passive_states = [] if @passive_states.nil?
return @passive_states.include?(state_id)
end
#--------------------------------------------------------------------------
# new method: passive_states
#--------------------------------------------------------------------------
def passive_states
array = []
if actor?
for state_id in self.actor.passive_states
array.push($data_states[state_id]) if passive_state_addable?(state_id)
end
for state_id in self.class.passive_states
array.push($data_states[state_id]) if passive_state_addable?(state_id)
end
for equip in equips
next if equip.nil?
for state_id in equip.passive_states
array.push($data_states[state_id]) if passive_state_addable?(state_id)
end
end
else # enemy
for state_id in self.enemy.passive_states
array.push($data_states[state_id]) if passive_state_addable?(state_id)
end
if $imported["YEA-Doppelganger"] && !self.class.nil?
for state_id in self.class.passive_states
array.push($data_states[state_id]) if passive_state_addable?(state_id)
end
end
end
create_passive_state_array(array)
sort_passive_states(array)
set_passive_state_turns(array)
return array
end
#--------------------------------------------------------------------------
# new method: create_passive_state_array
#--------------------------------------------------------------------------
def create_passive_state_array(array)
@passive_states = []
for state in array
@passive_states.push(state.id)
end
end
#--------------------------------------------------------------------------
# new method: passive_state_addable?
#--------------------------------------------------------------------------
def passive_state_addable?(state_id)
return false if $data_states[state_id].nil?
return alive?
end
#--------------------------------------------------------------------------
# new method: set_passive_state_turns
#--------------------------------------------------------------------------
def sort_passive_states(array)
array.sort! do |state_a, state_b|
if state_a.priority != state_b.priority
state_b.priority <=> state_a.priority
else
state_a.id <=> state_b.id
end
end
return array
end
#--------------------------------------------------------------------------
# new method: set_passive_state_turns
#--------------------------------------------------------------------------
def set_passive_state_turns(array)
for state in array
@state_turns[state.id] = 0 unless @states.include?(state.id)
@state_steps[state.id] = 0 unless @states.include?(state.id)
end
end
end # Game_BattlerBase
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# alias method: state_addable?
#--------------------------------------------------------------------------
alias game_battler_state_addable_ps state_addable?
def state_addable?(state_id)
return false if passive_state?(state_id)
return game_battler_state_addable_ps(state_id)
end
#--------------------------------------------------------------------------
# alias method: remove_state
#--------------------------------------------------------------------------
alias game_battler_remove_state_ps remove_state
def remove_state(state_id)
return if passive_state?(state_id)
game_battler_remove_state_ps(state_id)
end
end # Game_Battler
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1