Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

FFX CBA (FFX battle damage)

Status
Not open for further replies.

Shiro

Member

I never tried, but it SHOULD work with RTAB because RTAB never messes with the Game_Battler 3 scripts (to my knowledge anyway)
 
Ah it doesnt work with it... Since the RTAB changes self.damage to self.damage[attacker] and for skills it changes it to self.damage[user]

But I made it work by editing the RTAB Script though!

AND IT WORKS WITH THE MINKOFF SYSTEMS!!

In RTAB
Change this lines
Code:
  #--------------------------------------------------------------------------
  # ● 通常攻撃の効果適用
  #     attacker : 攻撃者 (バトラー)
  #--------------------------------------------------------------------------
  def attack_effect(attacker)
    # クリティカルフラグをクリア
    self.critical[attacker] = false
    state_p[attacker] = []
    state_m[attacker] = []
    # 第一命中判定
    hit_result = (rand(100) < attacker.hit)
    # 命中の場合
    if hit_result == true
      # 基本ダメージを計算
      atk = [attacker.atk - self.pdef / 2, 0].max
      self.damage[attacker] = atk * (20 + attacker.str) / 20
      # 属性修正
      self.damage[attacker] *= elements_correct(attacker.element_set)
      self.damage[attacker] /= 100
      # ダメージの符号が正の場合
      if self.damage[attacker] > 0
        # クリティカル修正
        if rand(100) < 4 * attacker.dex / self.agi
          self.damage[attacker] *= 2
          self.critical[attacker] = true
        end
        # 防御修正
        if self.guarding?
          self.damage[attacker] /= 2
        end
      end
      # 分散
      if self.damage[attacker].abs > 0
        amp = [self.damage[attacker].abs * 15 / 100, 1].max
        self.damage[attacker] += rand(amp+1) + rand(amp+1) - amp
      end
      # 第二命中判定
      eva = 8 * self.agi / attacker.dex + self.eva
      hit = self.damage[attacker] < 0 ? 100 : 100 - eva
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
    end
    # 命中の場合
    if hit_result == true
      # ステート衝撃解除
      remove_states_shock
      # HP からダメージを減算
      # ステート変化
      @state_changed = false
      states_plus(attacker, attacker.plus_state_set)
      states_minus(attacker, attacker.minus_state_set)
    # ミスの場合
    else
      # ダメージに "Miss" を設定
      self.damage[attacker] = "Miss"
      # クリティカルフラグをクリア
      self.critical[attacker] = false
    end
    # メソッド終了
    return true
  end
  #--------------------------------------------------------------------------
  # ● スキルの効果適用
  #     user  : スキルの使用者 (バトラー)
  #     skill : スキル
  #--------------------------------------------------------------------------
  def skill_effect(user, skill)
    # クリティカルフラグをクリア
    self.critical[user] = false
    state_p[user] = []
    state_m[user] = []
    # スキルの効果範囲が 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[user] = power * rate / 20
      # 属性修正
      self.damage[user] *= elements_correct(skill.element_set)
      self.damage[user] /= 100
      # ダメージの符号が正の場合
      if self.damage[user] > 0
        # 防御修正
        if self.guarding?
          self.damage[user] /= 2
        end
      end
      # 分散
      if skill.variance > 0 and self.damage[user].abs > 0
        amp = [self.damage[user].abs * skill.variance / 100, 1].max
        self.damage[user] += rand(amp+1) + rand(amp+1) - amp
      end
      # 第二命中判定
      eva = 8 * self.agi / user.dex + self.eva
      hit = self.damage[user] < 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.damage[user], self.maxhp].min, 0].max
      # 効果判定
      effective |= self.hp != last_hp
      # ステート変化
      @state_changed = false
      effective |= states_plus(user, skill.plus_state_set)
      effective |= states_minus(user, skill.minus_state_set)
      unless $game_temp.in_battle
        self.damage_effect(user, 1)
      end
      # 威力が 0 の場合
      if skill.power == 0
        # ダメージに空文字列を設定
        self.damage[user] = ""
        # ステートに変化がない場合
        unless @state_changed
          # ダメージに "Miss" を設定
          self.damage[user] = "Miss"
        end
      end
    # ミスの場合
    else
      # ダメージに "Miss" を設定
      self.damage[user] = "Miss"
    end
    # 戦闘中でない場合
    unless $game_temp.in_battle
      # ダメージに nil を設定
      self.damage[user] = nil
    end
    # メソッド終了
    return effective
  end

to this

Code:
  #--------------------------------------------------------------------------
  # ● 通常攻撃の効果適用
  #     attacker : 攻撃者 (バトラー)
  #--------------------------------------------------------------------------
  def attack_effect(attacker)
    # クリティカルフラグをクリア
    self.critical[attacker] = false
    state_p[attacker] = []
    state_m[attacker] = []
    # 第一命中判定
    hit_result = (rand(100) < attacker.hit)
    # 命中の場合
    if hit_result == true
      # 基本ダメージを計算
      atk = (((attacker.str * attacker.str * attacker.str) / 32) + 30)
      self.damage[attacker] = ((atk * ((((self.pdef - 280) * (self.pdef - 280))/110) + 16))/730) * (730 - (self.pdef * 51 - (self.pdef * self.pdef) / 11) / 10) / 730
      self.damage[attacker] /= 100
      # ダメージの符号が正の場合
      if self.damage[attacker] > 0
        # クリティカル修正
        if rand(100) < 4 * attacker.dex / self.agi
          self.damage[attacker] *= 2
          self.critical[attacker] = true
        end
        # 防御修正
        if self.guarding?
          self.damage[attacker] /= 2
        end
      end
      # 分散
      if self.damage[attacker].abs > 0
        amp = [self.damage[attacker].abs * 15 / 100, 1].max
        self.damage[attacker] += rand(amp+1) + rand(amp+1) - amp
      end
      # 第二命中判定
      eva = 8 * self.agi / attacker.dex + self.eva
      hit = self.damage[attacker] < 0 ? 100 : 100 - eva
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
    end
    # 命中の場合
    if hit_result == true
      # ステート衝撃解除
      remove_states_shock
      # HP からダメージを減算
      # ステート変化
      @state_changed = false
      states_plus(attacker, attacker.plus_state_set)
      states_minus(attacker, attacker.minus_state_set)
    # ミスの場合
    else
      # ダメージに "Miss" を設定
      self.damage[attacker] = "Miss"
      # クリティカルフラグをクリア
      self.critical[attacker] = false
    end
    # メソッド終了
    return true
  end
  #--------------------------------------------------------------------------
  # ● スキルの効果適用
  #     user  : スキルの使用者 (バトラー)
  #     skill : スキル
  #--------------------------------------------------------------------------
  def skill_effect(user, skill)
    # クリティカルフラグをクリア
    self.critical[user] = false
    state_p[user] = []
    state_m[user] = []
    # スキルの効果範囲が 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 = (skill.power * (((user.int * user.int) / 6) + skill.power) / 4)
      self.damage[user] = (rate * ((((self.mdef - 280) * (self.mdef - 280))/110) + 16)/730) * (730 - (self.mdef * 51 - (self.mdef * self.mdef) / 11) / 10) / 730
     if skill.atk_f == 1
       rate = (((user.str * user.str * user.str) / 32) + 30)
        self.damage[user] = ((rate * ((((self.pdef - 280) * (self.pdef - 280))/110) + 16))/730) * (730 - (self.pdef * 51 - (self.pdef * self.pdef) / 11) / 10) / 730
    end
    if skill.atk_f == 2
       rate = ( skill.power * ((user.int + skill.power) / 2)) * ( 0 -1)
      self.damage[user] = rate 
      end
      # 属性修正
      self.damage[user] /= 100
      # ダメージの符号が正の場合
      if self.damage[user] > 0
        # 防御修正
        if self.guarding?
          self.damage[user] /= 2
        end
      end
      # 分散
      if skill.variance > 0 and self.damage[user].abs > 0
        amp = [self.damage[user].abs * skill.variance / 100, 1].max
        self.damage[user] += rand(amp+1) + rand(amp+1) - amp
      end
      # 第二命中判定
      eva = 8 * self.agi / user.dex + self.eva
      hit = self.damage[user] < 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.damage[user], self.maxhp].min, 0].max
      # 効果判定
      effective |= self.hp != last_hp
      # ステート変化
      @state_changed = false
      effective |= states_plus(user, skill.plus_state_set)
      effective |= states_minus(user, skill.minus_state_set)
      unless $game_temp.in_battle
        self.damage_effect(user, 1)
      end
      # 威力が 0 の場合
      if skill.power == 0
        # ダメージに空文字列を設定
        self.damage[user] = ""
        # ステートに変化がない場合
        unless @state_changed
          # ダメージに "Miss" を設定
          self.damage[user] = "Miss"
        end
      end
    # ミスの場合
    else
      # ダメージに "Miss" を設定
      self.damage[user] = "Miss"
    end
    # 戦闘中でない場合
    unless $game_temp.in_battle
      # ダメージに nil を設定
      self.damage[user] = nil
    end
    # メソッド終了
    return effective
  end

I only tested it on RTAB v1.15
 

Anonymous

Guest

I don't now why, but this code don't work for me...
I mean, One of my characters have str = 15 (like Tidus) and and attack monster with def = 1, but attack damage only 17-30, not 100 Like FFX.

Whta i'm doing wrong?
 
You could just search the I-net for that or make a new game and check there ( in case you have a PS2 and a FFX DVD) but anyway I have a small problem:

If all your stats are 255 and the enemy has a physical defence of 255 the damage is around 300 HP this could definatley be not right, could it?
 
The algorithm screws up if the stats are too high, it's because of the -51 in the second part. Essentially, because that is the constant, it creates a double negative if the physical defence is greater than it.

My guess is the original algorithms were incremented, so the constant changed up every 50 or so. So for PDEF of 51 - 100, it would have used 101 as a constant.
Not sure, though. But to see what I mean, try plugging in a very low ATK and a very high PDEF.
 
I did that already but the damage was always 0 or it missed. I have no idea. I already tried searching the Internet if the damage algorithms were posted anywhere else, but I couldn't find anything...
 
I have a question then. What should I set my characters strength and such to as to where hes not like a freaking God on there. He kills everything in one hit.
 
The maximum stats. in very FF game are 255 so I guess you should pick something below that ^^

And well it's not that hard to figure out... Simply try a bit until you're satisfied...
 
Viviatus;233453 said:
The maximum stats. in very FF game are 255 so I guess you should pick something below that ^^

And well it's not that hard to figure out... Simply try a bit until you're satisfied...

Nope, only VI, VII, VIII, X/X-2 has 255 as the max stat, the others are all 99.
I've made one taking that FAQ as basis, The damage for 255 def is totally wrong for both(mine and hydro's), with a normal weapon calculation, it's possible to reach 15k+ damage through the original algorithm and 99999 with a celestial weapon(max bonus of ~=1000%, multiplied by 10.909090), while you can reach a miserable 446 damage using this one.
Code:
@str_p = attacker.str
@atk_p = 16
@def = self.pdef
@base = (((@str_p ** 3 / 32) + 32) * @atk_p / 16)
@defval = @def - 280.4
@defnum = ((@defval ** 2) / 110) + 16
@base2 = @base * @defnum / 730
@output = @base2[U] * (730 - (@def * 51 - @def ** 2 / 11) / 10) / 730[/U]
self.damage = Integer(@output)
I found a way to make the damage reach the 15k+ damage with 255 str and def, just remove the underlined part, the bad part is that the you can reach high damages at early.
e.g you can reach 60k+ damage with 127 str only(defense value = 1)
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top