应该是这样
# 给状态命名时:状态名,附加的属性ID # 比如:蓄力,3 这个 蓄力 状态就会附加 3 号属性。<仅限普通攻击> #不附加属性就不写后面的属性ID module RPG class State def name @name.split(/,/)[0] != nil ? @name.split(/,/)[0] : "" end def element_id @name.split(/,/)[1] != nil ? @name.split(/,/)[1].to_i : 0 end end end #============================================================================= class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● 获取普通攻击属性 #-------------------------------------------------------------------------- def element_set state_elements = [] self.states.each do |id| state = $data_states[id] state_elements.push(state.element_id) if state.element_id > 0 end weapon = $data_weapons[@weapon_id] weapon_elements = weapon != nil ? weapon.element_set : [] return state_elements | weapon_elements end end #==============================================================================
# 给状态命名时:状态名,附加的属性ID
# 比如:蓄力,3 这个 蓄力 状态就会附加 3 号属性。<仅限普通攻击>
#不附加属性就不写后面的属性ID
module RPG
class State
def name
@name.split(/,/)[0] != nil ? @name.split(/,/)[0] : ""
end
def element_id
@name.split(/,/)[1] != nil ? @name.split(/,/)[1].to_i : 0
end
end
end
#=============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 获取普通攻击属性
#--------------------------------------------------------------------------
def element_set
state_elements = []
self.states.each do |id|
state = $data_states[id]
state_elements.push(state.element_id) if state.element_id > 0
end
weapon = $data_weapons[@weapon_id]
weapon_elements = weapon != nil ? weapon.element_set : []
return state_elements | weapon_elements
end
end
#==============================================================================
|