赞 | 6 |
VIP | 356 |
好人卡 | 3 |
积分 | 2 |
经验 | 297560 |
最后登录 | 2022-1-18 |
在线时间 | 509 小时 |
Lv1.梦旅人 有事烧纸
- 梦石
- 0
- 星屑
- 154
- 在线时间
- 509 小时
- 注册时间
- 2005-10-22
- 帖子
- 6982
|
66,随机atk脚本完成~
第一种思路:
- 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(7)-3
- 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
- now = i
- break
- end
- end
- if now == 0
- new_weapon = RPG::Weapon.new
- 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.icon_name = $data_weapons[weapon_id].icon_name
- new_weapon.description = $data_weapons[weapon_id].description
- new_weapon.animation1_id = $data_weapons[weapon_id].animation1_id
- new_weapon.animation2_id = $data_weapons[weapon_id].animation2_id
- new_weapon.price = $data_weapons[weapon_id].price
- new_weapon.atk = $data_weapons[weapon_id].atk+add_atk
- new_weapon.pdef = $data_weapons[weapon_id].pdef
- new_weapon.mdef = $data_weapons[weapon_id].mdef
- new_weapon.str_plus = $data_weapons[weapon_id].str_plus
- new_weapon.dex_plus = $data_weapons[weapon_id].dex_plus
- new_weapon.agi_plus = $data_weapons[weapon_id].agi_plus
- new_weapon.int_plus = $data_weapons[weapon_id].int_plus
- new_weapon.element_set = $data_weapons[weapon_id].element_set
- new_weapon.plus_state_set = $data_weapons[weapon_id].plus_state_set
- new_weapon.minus_state_set = $data_weapons[weapon_id].minus_state_set
- $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
复制代码
防具也可以如此设置,
还有注意 $data_weapons 和 $data_classes 存入存档,如果设置了armor的也存入~
第二种考虑在 Game_Party增加独立的武器防具数据在存放武器,但这样改动的地方更多一些,冲突更大。
|
|