#--------------------------------------------------------------------------
# ● 附加状态
# state_id : 状态 ID
# force : 强制附加标志 (处理自动状态时使用)
#--------------------------------------------------------------------------
def add_state(state_id, force = false)
if $data_states[state_id] == nil
return
end
###################################################################
if @states.size > 0 and not $data_states[state_id].zero_hp
return
end
##############################################################
unless force
for i in @states
if $data_states.minus_state_set.include?(state_id) and
not $data_states[state_id].minus_state_set.include?(i)
return
end
end
end
unless state?(state_id)
@states.push(state_id)
if $data_states[state_id].zero_hp
@hp = 0
end
for i in 1...$data_states.size
if $data_states[state_id].plus_state_set.include?(i)
add_state(i)
end
if $data_states[state_id].minus_state_set.include?(i)
remove_state(i)
end
end
@states.sort! do |a, b|
state_a = $data_states[a]
state_b = $data_states
if state_a.rating > state_b.rating
-1
elsif state_a.rating < state_b.rating
+1
elsif state_a.restriction > state_b.restriction
-1
elsif state_a.restriction < state_b.restriction
+1
else
a <=> b
end
end
end
# 强制附加的场合
if force
@states_turn[state_id] = -1
end
unless @states_turn[state_id] == -1
@states_turn[state_id] = $data_states[state_id].hold_turn
end
unless movable?
@current_action.clear
end
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
[LINE]1,#dddddd[/LINE]系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~