#==============================================================================
# 状态增减固定属性
#==============================================================================
# Author : 芯☆淡茹水
#==============================================================================
# 1,状态关联公共事件。
# 状态名后面加上 ☆ ,接着写上公共事件ID。
#
# 2,对应公共事件的编辑。
# 公共事件编辑 注释 ,然后写上以下的对应备注项。
# 注意:两项之间不要接连备注,用随意字符或空格隔开以及换行都行。
# 备注格式:<maxhp:num> 最大HP
# <maxsp:num> 最大SP
# <str:num> 力量
# <dex:num> 敏捷
# <agi:num> 速度
# <int:num> 魔力
# <atk:num> 攻击力
# <pdef:num> 防御力
# <mdef:num> 魔法防御力
#
# 里面的 num 为增/减的值,正加负减,不要留空格。例: <maxhp:200> , <str:-20>
#
#==============================================================================
module RPG
class State
#--------------------------------------------------------------------------
def name; return @name.split("☆")[0] || ""; end
#--------------------------------------------------------------------------
def spce_id; return @name.split("☆")[1].to_i || 0; end
end
end
#==============================================================================
module XdRs_Sp
#--------------------------------------------------------------------------
def self.state_has_spce?(state_id)
event = self.spce_event(state_id)
return event && event.list.any?{|l| l.code == 108 }
end
#--------------------------------------------------------------------------
def self.spce_event(state_id)
return $data_common_events[$data_states[state_id].spce_id]
end
#--------------------------------------------------------------------------
def self.state_add(state_id, sym)
return 0 unless self.state_has_spce?(state_id)
note = self.event_note(self.spce_event(state_id))
return $1.to_i if note.match(Regexp.new("<#{sym}:(\\d+)>"))
return -$1.to_i if note.match(Regexp.new("<#{sym}:-(\\d+)>"))
return 0
end
#--------------------------------------------------------------------------
def self.event_note(event)
note = event.list.find_all{|l| [108,408].include?(l.code)}.map{|l| l.parameters[0]}
return note.join(";")
end
end
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
def state_add(sym)
return 0 if @states.empty?
return eval(@states.map{|id| XdRs_Sp.state_add(id, sym)}.join("+"))
end
#--------------------------------------------------------------------------
alias xr_state_property_maxhp maxhp
def maxhp
n = xr_state_property_maxhp + state_add("maxhp")
return [[n, 1].max, 999999].min
end
#--------------------------------------------------------------------------
alias xr_state_property_maxsp maxsp
def maxsp
n = xr_state_property_maxsp + state_add("maxsp")
return [[n, 0].max, 9999].min
end
#--------------------------------------------------------------------------
alias xr_state_property_str str
def str
n = xr_state_property_str + state_add("str")
return [[n, 0].max, 999].min
end
#--------------------------------------------------------------------------
alias xr_state_property_dex dex
def dex
n = xr_state_property_dex + state_add("dex")
return [[n, 0].max, 999].min
end
#--------------------------------------------------------------------------
alias xr_state_property_agi agi
def agi
n = xr_state_property_agi + state_add("agi")
return [[n, 0].max, 999].min
end
#--------------------------------------------------------------------------
alias xr_state_property_int int
def int
n = xr_state_property_int + state_add("int")
return [[n, 0].max, 999].min
end
#--------------------------------------------------------------------------
alias xr_state_property_atk atk
def atk; return xr_state_property_atk + state_add("atk"); end
#--------------------------------------------------------------------------
alias xr_state_property_pdef pdef
def pdef; return xr_state_property_pdef + state_add("pdef"); end
#--------------------------------------------------------------------------
alias xr_state_property_mdef mdef
def mdef; return xr_state_property_mdef + state_add("mdef"); end
end
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
alias xr_state_property_maxhp maxhp
def maxhp
n = xr_state_property_maxhp + state_add("maxhp")
return [[n, 1].max, 9999].min
end
end
#==============================================================================
#==============================================================================