class Game_Party def gain_weapon(weapon_id, n) if weapon_id > 0 # 商店购买 或 装备栏中卸下的武器不进行随机处理~ if $scene.is_a?(Scene_Shop) or $scene.is_a?(Scene_Equip) @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min else # 随机浮动范围~★★★★★★★ add_atk = rand(50)-25 if add_atk == 0 @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min else now = 0 # 判断数据库中是否已经有 相同属性的武器~ for i in weapon_id...$data_weapons.size if $data_weapons[i].atk == $data_weapons[weapon_id].atk+add_atk and ($data_weapons[i].name.split('+')[0] == $data_weapons[weapon_id].name or $data_weapons[i].name.split('-')[0] == $data_weapons[weapon_id].name) now = i break end end if now == 0 # 无相同属性时则 重新生成~ new_weapon = $data_weapons[weapon_id].clone new_weapon.id = $data_weapons.size if add_atk<0 new_weapon.name = $data_weapons[weapon_id].name+"-"+add_atk.abs.to_s else new_weapon.name = $data_weapons[weapon_id].name+"+"+add_atk.abs.to_s end new_weapon.atk = $data_weapons[weapon_id].atk+add_atk $data_weapons.push(new_weapon) # 职业可装备武器数组更新~ for i in 1...$data_classes.size if $data_classes[i].weapon_set.include?(weapon_id) $data_classes[i].weapon_set.push(new_weapon.id) end end # 增加武器~ @weapons[new_weapon.id] = [[weapon_number(new_weapon.id) + n, 0].max, 99].min else # 有相同属性则直接 增加武器~ @weapons[now] = [[weapon_number(now) + n, 0].max, 99].min end end end end end def lose_weapon(weapon_id, n) if weapon_id > 0 @weapons[weapon_id] = [[weapon_number(weapon_id) - n, 0].max, 99].min end end end |