def state_guard?(state_id)
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
armor = $data_armors[i]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
end
return false
end
def state_guard?(state_id)
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
armor = $data_armors[i]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
end
return false
end
那个for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]def state_guard?(state_id)
armor = $data_armors[@armor1_id]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
armor = $data_armors[@armor2_id]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
armor = $data_armors[@armor3_id]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
armor = $data_armors[@armor4_id]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
return false
end
def state_guard?(state_id)
armor = $data_armors[@armor1_id]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
armor = $data_armors[@armor2_id]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
armor = $data_armors[@armor3_id]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
armor = $data_armors[@armor4_id]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
return false
end
简单来说就是把"重复的, 只有一个元素不同的"脚本简化