查看: 3426|回复: 1

[已经过期] 关于“无敌”状态的修改。

[复制链接]
梦石
0
星屑
3181
在线时间
1439 小时
注册时间
2009-7-27
回帖
1187
发表于 2015-8-19 01:52:02 | 显示全部楼层 |阅读模式

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

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

×
  就是说这个无敌状态脚本,如何修改成对 某些 属性的敌人才有效?比如说,1号敌人属性为没有或者其他的,攻击角色才有伤害。2号角色属性为某某某,攻击角色就没有伤害了。也就是说一些我设置了特殊的敌人攻击我方附有 无敌 状态的角色才没有伤害。请问这样说能懂吗?而且我方附有 无敌 状态时被特殊属性的敌人攻击时显示某个动画。请高手帮忙修改一下。

[pre lang="ruby"]#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/  ◆无敌状态 - KGC_Invincible◆
#_/----------------------------------------------------------------------------
#_/ 在状态中设置个“无敌”二字的状态即可使用。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

$imported = {} if $imported == nil
$imported["Invincible"] = true

if $game_special_states == nil
  $game_special_states = {}
  $data_states = load_data("Data/States.rxdata")
end
# 無敵状態ステートIDa取得
state = $data_states.compact.find { |s| s.name == "无敌" }
$game_special_states["invincible"] = state != nil ? state.id : 0

#==============================================================================
# ■ Game_Battler (分割定義 2)
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # ● ステート [無敵] 判定
  #     act : 処理対象
  #--------------------------------------------------------------------------
  def invincible?(act = nil)
    # ステート[無敵]が付加されている場合
    if self.states.include?($game_special_states["invincible"])
      # 処理対象で分岐
      case act
      when RPG::Skill
        return true if act.scope == 1 || act.scope == 2
      when RPG::Item
        return true if act.scope == 1 || act.scope == 2
      when nil
        return true
      end
    end
    return false
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Battler (分割定義 3)
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # ● 通常攻撃の効果適用
  #--------------------------------------------------------------------------
  alias attack_effect_KGC_Invincible attack_effect
  def attack_effect(attacker)
    # 無敵状態の場合
    if self.invincible?
      # ダメージに "Miss" を設定
      self.damage = "Miss"
      # クリティカルフラグをクリア
      self.critical = false
      # 偽を返す
      return false
    end

    # 元の処理を実行
    return attack_effect_KGC_Invincible(attacker)
  end
  #--------------------------------------------------------------------------
  # ● スキルの効果適用
  #--------------------------------------------------------------------------
  alias skill_effect_KGC_Invincible skill_effect
  def skill_effect(user, skill)
    # 無敵状態の場合
    if self.invincible?(skill)
      # ダメージに "Miss" を設定
      self.damage = "Miss"
      # クリティカルフラグをクリア
      self.critical = false
      # 偽を返す
      return false
    end

    # 元の処理を実行
    return skill_effect_KGC_Invincible(user, skill)
  end
  #--------------------------------------------------------------------------
  # ● アイテムの効果適用
  #--------------------------------------------------------------------------
  alias item_effect_KGC_Invincible item_effect
  def item_effect(item)
    # 無敵状態の場合
    if self.invincible?(item)
      # ダメージに "Miss" を設定
      self.damage = "Miss"
      # クリティカルフラグをクリア
      self.critical = false
      # 偽を返す
      return false
    end

    # 元の処理を実行
    return item_effect_KGC_Invincible(item)
  end
end[/pre]

博客:我的博客
梦石
0
星屑
946
在线时间
61 小时
注册时间
2019-12-10
回帖
89
发表于 2021-5-6 11:34:04 | 显示全部楼层
用上了,真的无敌了
想玩我做的游戏加我qq947128749
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部