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

Project1

 找回密码
 注册会员
搜索
查看: 555|回复: 4
打印 上一主题 下一主题

[有事请教] 请教关于技能伤害

[复制链接]

Lv1.梦旅人

梦石
0
星屑
198
在线时间
36 小时
注册时间
2023-7-9
帖子
7
跳转到指定楼层
1
发表于 2023-9-9 12:18:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
请教如何把技能伤害计算改为普通攻击伤害计算
谁能帮我修改一下谢谢!!!!!!!!!!!!!
因为我这是自动战斗所以不需要判断技能伤害使用技能也是按照普通攻击计算伤害使用技能只需要技能特效和发动公共事件
不需要按照原来的魔法伤害计算魔法伤害改成别的属性了
也就是说当发动技能时造成的伤害按照普攻平a的计算方式就好了 谢谢拉
#--------------------------------------------------------------------------
  # ● 应用特技效果
  #     user  : 特技的使用者 (battler)
  #     skill : 特技
  #--------------------------------------------------------------------------
  def skill_effect(user, skill)
    # 清除会心一击标志
    self.critical = false
    # 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
    # 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
    if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
       ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
      # 过程结束
      return false
    end
    # 清除有效标志
    effective = false
    # 公共事件 ID 是有效的情况下,设置为有效标志
    effective |= skill.common_event_id > 0
    # 第一命中判定
    hit = skill.hit
    if skill.atk_f > 0
      hit *= user.hit / 100
    end
    hit_result = (rand(100) < hit)
    # 不确定的特技的情况下设置为有效标志
    effective |= hit < 100
    # 命中的情况下
    if hit_result == true
      # 计算威力
      power = skill.power + user.atk * skill.atk_f / 100
      if power > 0
        power -= self.pdef * skill.pdef_f / 200
        power -= self.mdef * skill.mdef_f / 200
        power = [power, 0].max
      end
      # 计算倍率
      rate = 20
      rate += (user.str * skill.str_f / 100)
      rate += (user.dex * skill.dex_f / 100)
      rate += (user.agi * skill.agi_f / 100)
      rate += (user.int * skill.int_f / 100)
      # 计算基本伤害
      self.damage = power * rate / 20
      # 属性修正
      self.damage *= elements_correct(skill.element_set)
      self.damage /= 100
      # 伤害符号正确的情况下
      if self.damage > 0
        # 防御修正
        if self.guarding?
          self.damage /= 2
        end
      end
      # 分散
      if skill.variance > 0 and self.damage.abs > 0
        amp = [self.damage.abs * skill.variance / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      # 第二命中判定
      eva = 8 * self.agi / user.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
      # 不确定的特技的情况下设置为有效标志
      effective |= hit < 100
    end
    # 命中的情况下
    if hit_result == true
      # 威力 0 以外的物理攻击的情况下
      if skill.power != 0 and skill.atk_f > 0
        # 状态冲击解除
        remove_states_shock
        # 设置有效标志
        effective = true
      end
      # HP 的伤害减法运算
      last_hp = self.hp
      self.hp -= self.damage
      effective |= self.hp != last_hp
      # 状态变化
      @state_changed = false
      effective |= states_plus(skill.plus_state_set)
      effective |= states_minus(skill.minus_state_set)
      # 威力为 0 的场合
      if skill.power == 0
        # 伤害设置为空的字串
        self.damage = ""
        # 状态没有变化的情况下
        unless @state_changed
          # 伤害设置为 "Miss"
          self.damage = "Miss"
        end
      end
    # Miss 的情况下
    else
      # 伤害设置为 "Miss"
      self.damage = "Miss"
    end
    # 不在战斗中的情况下
    unless $game_temp.in_battle
      # 伤害设置为 nil
      self.damage = nil
    end
    # 过程结束
    return effective
  end

Lv5.捕梦者

梦石
0
星屑
33213
在线时间
10497 小时
注册时间
2009-3-15
帖子
4756
2
发表于 2023-9-9 14:21:25 | 只看该作者
RUBY 代码复制
  1. #--------------------------------------------------------------------------
  2.   # ● 生成特技行动结果
  3.   #--------------------------------------------------------------------------
  4.   def make_skill_action_result
  5.     # 获取特技
  6.     @skill = $data_skills[@active_battler.current_action.skill_id]
  7.     # 如果不是强制行动
  8.     unless @active_battler.current_action.forcing
  9.       # 因为 SP 耗尽而无法使用的情况下
  10.       unless @active_battler.skill_can_use?(@skill.id)
  11.         # 清除强制行动对像的战斗者
  12.         $game_temp.forcing_battler = nil
  13.         # 移至步骤 1
  14.         @phase4_step = 1
  15.         return
  16.       end
  17.     end
  18.     # 消耗 SP
  19.     @active_battler.sp -= @skill.sp_cost
  20.     # 刷新状态窗口
  21.     @status_window.refresh
  22.     # 在帮助窗口显示特技名
  23.     @help_window.set_text(@skill.name, 1)
  24.     # 设置动画 ID
  25.     @animation1_id = @skill.animation1_id
  26.     @animation2_id = @skill.animation2_id
  27.     # 设置公共事件 ID
  28.     @common_event_id = @skill.common_event_id
  29.     # 设置对像侧战斗者
  30.     set_target_battlers(@skill.scope)
  31.     # 应用特技效果
  32.     for target in @target_battlers
  33.       target.skill_effect(@active_battler, @skill)
  34.     end
  35.   end


target.skill_effect(@active_battler, @skill)
改成
target.attack_effect(@active_battler)

评分

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

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
198
在线时间
36 小时
注册时间
2023-7-9
帖子
7
3
 楼主| 发表于 2023-9-9 19:57:01 | 只看该作者
那么简单 多谢了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
198
在线时间
36 小时
注册时间
2023-7-9
帖子
7
4
 楼主| 发表于 2023-9-25 09:04:47 | 只看该作者
问题解决后 怎么结贴变成问题已解决状态

点评

每隔一两周,会有大佬来分类的  发表于 2023-9-28 10:29
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2024-5-3 22:18

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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