Project1
标题: 能否把武器攻击力随机改成装备能力随机 [打印本页]
作者: u566 时间: 2011-4-16 19:48
标题: 能否把武器攻击力随机改成装备能力随机
本帖最后由 u566 于 2011-4-23 21:09 编辑
感觉夏娜大大的武器攻击力随机脚本很好,我想问问能不能把武器攻击力随机改成装备能力随机,品质就是新属性总和减旧属性总和,大于0精良,大于10极品等等。脚本知识有限,试了几次都不成功,求修改,附上脚本- class Game_Party
- def gain_weapon(weapon_id, n)
- if weapon_id > 0
- # 装备栏中卸下的武器、物品栏里卸下的武器、合成的武器不进行随机处理~
- if $scene.is_a?(Scene_Equip)or$scene.is_a?(Scene_Item)or$scene.is_a?(Scene_Combine)
- @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+" 破烂"
- if add_atk<10
- new_weapon.name = $data_weapons[weapon_id].name+" 粗糙"
- end
- else
- if add_atk<10
- new_weapon.name = $data_weapons[weapon_id].name+" 精良"
- else
- new_weapon.name = $data_weapons[weapon_id].name+" 极品"
- end
- 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
复制代码