设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索

如何增加变异的种类

查看数: 362 | 评论数: 5 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
fjm
发布时间: 2025-4-8 15:17

正文摘要:

本帖最后由 fjm 于 2025-4-8 15:21 编辑 问下如何增加变异的种类,例如初级变异增加10%的能力,中级变异增加20%,高级变异增加30% 初级变异出现几率10%,中级5%,高级1% class Game_Actor < Game_Battler &nbs ...

回复

魔法丶小肉包 发表于 2025-4-28 17:36:34
fjm 发表于 2025-4-24 09:28
def init_pet_param
  @tan_pet_param = [0] * 8
  if @tan_pet_id != 0

你给的两段就会报错,修复了一下
RUBY 代码复制
  1. def init_pet_param
  2.   @tan_pet_param = [0] * 8
  3.   if @tan_pet_id != 0
  4.     for i in 0..7
  5.       a = Tan_pet_set::Tan_pet_base_param[@tan_pet_id][i]
  6.       b = Tan_pet_set::Tan_pet_rand_param[@tan_pet_id][i] * rand()
  7.       v = format("%.2f",a + b).to_f
  8.       v = format("%.2f",v * Tan_pet_set::Tan_pet_by_num[@nickid]).to_f if is_pet_by?
  9.       @tan_pet_param[i] = v
  10.     end
  11.   end
  12. end

点评

fjm
非常感谢,现在非常完美了  发表于 2025-5-8 17:56

评分

参与人数 1+1 收起 理由
fjm + 1 认可答案

查看全部评分

fjm 发表于 2025-4-24 09:28:27
魔法丶小肉包 发表于 2025-4-12 13:19
未测试

module Tan_pet_set中修改

def init_pet_param
  @tan_pet_param = [0] * 8
  if @tan_pet_id != 0
    for i in 0..7
      a = Tan_pet_set::Tan_pet_base_param[@tan_pet_id]
      b = Tan_pet_set::Tan_pet_rand_param[@tan_pet_id] * rand()
55行      v = format("%.2f",a + b).to_f
      v = format("%.2f",v * Tan_pet_set::Tan_pet_by_num[@nickid]).to_f if is_pet_by?
      @tan_pet_param = v
    end
  end
end

点评

我测试了一下,你贴的两段原脚本本来就会报这个错误  发表于 2025-4-28 17:09
魔法丶小肉包 发表于 2025-4-12 13:19:28
未测试

module Tan_pet_set中修改
#变异几率
Tan_pet_by = [10,5,1]
#变异的宠物比一般宠物成长属性的倍数
Tan_pet_by_num = [1.1,1.2,1.3]

class Game_Actor中修改
#--------------------------------------------------------------------------
# ● 宠物初始化
#--------------------------------------------------------------------------
def init_pet
  @tan_pet_id = self.actor.note =~ /<pet = (\d+?)>/i ? $1.to_i : 0
  @tan_pet_by = false
  nickname = ["初级变异","中级变异","高级变异"]
  @nickname = "" if is_pet?
  Tan_pet_set::Tan_pet_by.each do |i|
    if rand(100) <= i
      @tan_pet_by = true
      @nickid = Tan_pet_set::Tan_pet_by.index(i)
      @nickname = nickname[@nickid] if is_pet_by?
    end
  end
  init_pet_param
  self.hp = self.mhp
  self.mp = self.mmp
end

#--------------------------------------------------------------------------
# ● 宠物成长属性初始化
#--------------------------------------------------------------------------
def init_pet_param
  @tan_pet_param = [0] * 8
  if @tan_pet_id != 0
    for i in 0..7
      a = Tan_pet_set::Tan_pet_base_param[@tan_pet_id]
      b = Tan_pet_set::Tan_pet_rand_param[@tan_pet_id] * rand()
      v = format("%.2f",a + b).to_f
      v = format("%.2f",v * Tan_pet_set::Tan_pet_by_num[@nickid]).to_f if is_pet_by?
      @tan_pet_param = v
    end
  end
end
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-6-4 18:37

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表