#使用说明:
#1.附加敌人初始状态需在数据库敌人里备注
#【<附加 状态编号>】或【<状态 状态编号>】【<STATE 状态编号>】 例:备注<状态 2> 战斗开始时该敌人会自带中毒状态
#2.数据库-状态备注【<击杀夺取>】【<ROB>】
#战斗时若打败拥有该状态的对手 则攻击方获得该状态
#3.数据库-状态备注【<石头的眷顾> 】什么鬼、【<防止清除>】 【<KEEP>】
#事件中【完全恢复】指令将无法清除这些状态,并且死亡时它们也不会消失
#==============================================================================
# ■ Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# ● 完全恢复
#--------------------------------------------------------------------------
alias robstate_recover_all recover_all
def recover_all
regexp = /<(?:石头的眷顾|防止清除|KEEP)>/i
backup = [@states.select {|id| $data_states[id].note =~ regexp},
@state_turns.select {|id| $data_states[id].note =~ regexp},
@state_steps.select {|id| $data_states[id].note =~ regexp}]
robstate_recover_all
@states |= backup[0]
@state_turns.merge!(backup[1]) {|k, old| old}
@state_steps.merge!(backup[2]) {|k, old| old}
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# ● 应用技能/物品的效果
#--------------------------------------------------------------------------
alias robstate_item_apply item_apply
def item_apply(user, item)
last_states = @states
robstate_item_apply(user, item)
return if alive?
last_states.each {|id| user.add_state(id) if
$data_states[id].note =~/<(?:击杀夺取|ROB)>/i }
end
#--------------------------------------------------------------------------
# ● 死亡
#--------------------------------------------------------------------------
alias robstate_die die
def die
regexp = /<(?:石头的眷顾|防止清除|KEEP)>/i
backup = [@states.select {|id| $data_states[id].note =~ regexp},
@state_turns.select {|id| $data_states[id].note =~ regexp},
@state_steps.select {|id| $data_states[id].note =~ regexp}]
robstate_die
@states |= backup[0]
@state_turns.merge!(backup[1]) {|k, old| old}
@state_steps.merge!(backup[2]) {|k, old| old}
end
end
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
alias robstate_initialize initialize
def initialize(index, enemy_id)
robstate_initialize(index, enemy_id)
enemy.note.scan(/<(?:附加|状态|STATE)\s*(\d+)>/i) { add_state($1.to_i) }
end
end