module RPG
class Armor
def description
desc = @description.split(/#/)[0]
return desc != nil ? desc : ""
end
def elemental_resistance
result = @description.scan(/#elem_res: ?([+\-]?[0-9]+)%/)
return result == [] ? 50 : $1.to_i
end
end
class State
def name
name = @name.split(/#/)[0]
return name != nil ? name : ""
end
def elemental_resistance
result = @name.scan(/#elem_res: ?([+\-]?[0-9]+)%/)
return result == [] ? 50 : $1.to_i
end
end
end
class Game_Actor
#--------------------------------------------------------------------------
# ● 取得属性修正值
# element_id : 属性 ID
#--------------------------------------------------------------------------
def element_rate(element_id)
# 获取对应属性有效度的数值
table = [0,200,150,100,50,0,-100]
result = table[$data_classes[@class_id].element_ranks[element_id]]
# 防具能防御本属性的情况下效果减少防御度
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
armor = $data_armors[i]
if armor != nil and armor.guard_element_set.include?(element_id)
result *= armor.elemental_resistance
result /= 100
end
end
# 状态能防御本属性的情况下效果减少防御度
for i in @states
if $data_states[i].guard_element_set.include?(element_id)
result *= $data_states[i].elemental_resistance
result /= 100
end
end
# 过程结束
return result
end
end