Project1

标题: 如何修改角色最大属性值? [打印本页]

作者: 601372608    时间: 2015-3-8 19:13
标题: 如何修改角色最大属性值?
问题同上,如何把攻击力防御力精神敏捷调大一点?默认最大值是999,我想调到99999
哪位大神能帮帮我,教教我改哪里?
还有物品系统默认最多是99个,我想调成9999个,这些都该调哪里呢?
我用事件处理战斗系统,但是角色最大属性值太低了才999。而且武器防具那些最大属性都很少都是500
这些都应该调哪里呢?
作者: 欧买歌    时间: 2015-3-8 20:06
  1. class Game_Battler
  2. def maxhp_limit
  3. return 999999
  4. end
  5. def maxhp
  6. return [[base_maxhp + @maxhp_plus, 1].max, maxhp_limit].min
  7. end
  8. def maxmp
  9. return [[base_maxmp + @maxmp_plus, 0].max, 999999].min
  10. end
  11. def atk
  12. n = [[base_atk + @atk_plus, 1].max, 99999].min
  13. for state in states do n *= state.atk_rate / 100.0 end
  14. n = [[Integer(n), 1].max, 99999].min
  15. return n
  16. end
  17. def def
  18. n = [[base_def + @def_plus, 1].max, 99999].min
  19. for state in states do n *= state.def_rate / 100.0 end
  20. n = [[Integer(n), 1].max, 99999].min
  21. return n
  22. end
  23. def spi
  24. n = [[base_spi + @spi_plus, 1].max, 99999].min
  25. for state in states do n *= state.spi_rate / 100.0 end
  26. n = [[Integer(n), 1].max, 99999].min
  27. return n
  28. end
  29. def agi
  30. n = [[base_agi + @agi_plus, 1].max, 99999].min
  31. for state in states do n *= state.agi_rate / 100.0 end
  32. n = [[Integer(n), 1].max, 99999].min
  33. return n
  34. end
  35. def maxhp=(new_maxhp)
  36. @maxhp_plus += new_maxhp - self.maxhp
  37. @maxhp_plus = [[@maxhp_plus, -999999].max, 999999].min
  38. @hp = [@hp, self.maxhp].min
  39. end
  40. def maxmp=(new_maxmp)
  41. @maxmp_plus += new_maxmp - self.maxmp
  42. @maxmp_plus = [[@maxmp_plus, -999999].max, 999999].min
  43. @mp = [@mp, self.maxmp].min
  44. end
  45. def atk=(new_atk)
  46. @atk_plus += new_atk - self.atk
  47. @atk_plus = [[@atk_plus, -99999].max, 99999].min
  48. end
  49. def def=(new_def)
  50. @def_plus += new_def - self.def
  51. @def_plus = [[@def_plus, -99999].max, 99999].min
  52. end
  53. def spi=(new_spi)
  54. @spi_plus += new_spi - self.spi
  55. @spi_plus = [[@spi_plus, -99999].max, 99999].min
  56. end
  57. def agi=(new_agi)
  58. @agi_plus += new_agi - self.agi
  59. @agi_plus = [[@agi_plus, -99999].max, 99999].min
  60. end
  61. end
复制代码

作者: 601372608    时间: 2015-3-9 09:42
欧买歌 发表于 2015-3-8 20:06

谢谢,我还想修改一下物品最大数量上限,把99个改成9999个,能帮我吗?
作者: 欧买歌    时间: 2015-3-9 16:33
  1. class Game_Party
  2. def gain_item(item, n, include_equip = false)
  3.     number = item_number(item)
  4.     case item
  5.     when RPG::Item
  6.       @items[item.id] = [[number + n, 0].max, 9999].min
  7.     when RPG::Weapon
  8.       @weapons[item.id] = [[number + n, 0].max, 9999].min
  9.     when RPG::Armor
  10.       @armors[item.id] = [[number + n, 0].max, 9999].min
  11.     end
  12.     n += number
  13.     if include_equip and n < 0
  14.       for actor in members
  15.         while n < 0 and actor.equips.include?(item)
  16.           actor.discard_equip(item)
  17.           n += 1
  18.         end
  19.       end
  20.     end
  21.   end
  22. end
复制代码





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1