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

Project1

 找回密码
 注册会员
搜索

如何添加无敌状态也无法免疫的状态,以及状态变化解除无敌

查看数: 167 | 评论数: 12 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2025-8-31 07:03

正文摘要:

想制作一个不受伤害的状态,于是找到了无敌状态脚本,结果发现了2个问题 1,这个状态连不能抵抗的状态都无法添加,这样想靠状态法做一些事情都做不了(毕竟状态法的前提是先添加上状态) 2,由于这个状态太无敌,我 ...

回复

无忧谷主幻 发表于 4 天前
soulsaga 发表于 2025-9-2 07:56
你用普攻对吧?照抄抄错了..已修

感谢,想解除无敌状态的问题已解决
soulsaga 发表于 4 天前
无忧谷主幻 发表于 2025-9-2 07:52
效果如何暂未测试,因为连状态都没办法加上了

你用普攻对吧?照抄抄错了..已修
soulsaga 发表于 4 天前
本帖最后由 soulsaga 于 2025-9-2 07:59 编辑

其实只要照抄默认的脚本过来就可以了[

quote]无忧谷主幻 发表于 2025-9-2 07:10
然后如何用条件分歧给刚刚攻击的目标附加或解除状态?[/quote]

RUBY 代码复制
  1. #_/  ◆无敌状态 - KGC_Invincible◆
  2. #_/----------------------------------------------------------------------------
  3. #_/ 在状态中设置个“无敌”二字的状态即可使用。
  4. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  5.  
  6. $imported = {} if $imported == nil
  7. $imported["Invincible"] = true
  8.  
  9. if $game_special_states == nil
  10.   $game_special_states = {}
  11.   $data_states = load_data("Data/States.rxdata")
  12. end
  13. # 無敵状態ステートIDa取得
  14. state = $data_states.compact.find { |s| s.name == "回避" }
  15. $game_special_states["invincible"] = state != nil ? state.id : 0
  16.  
  17. #==============================================================================
  18. # ■ Game_Battler (分割定義 2)
  19. #==============================================================================
  20.  
  21. class Game_Battler
  22.   #--------------------------------------------------------------------------
  23.   # ● ステート [無敵] 判定
  24.   #     act : 処理対象
  25.   #--------------------------------------------------------------------------
  26.   def invincible?(act = nil)
  27.     # ステート[無敵]が付加されている場合
  28.     if self.states.include?($game_special_states["invincible"])
  29.       # 処理対象で分岐
  30.       case act
  31.       when RPG::Skill
  32.         return true if act.scope == 1 || act.scope == 2
  33.       when RPG::Item
  34.         return true if act.scope == 1 || act.scope == 2
  35.       when nil
  36.         return true
  37.       end
  38.     end
  39.     return false
  40.   end
  41. end
  42.  
  43. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  44.  
  45. #==============================================================================
  46. # ■ Game_Battler (分割定義 3)
  47. #==============================================================================
  48.  
  49. class Game_Battler
  50.   #--------------------------------------------------------------------------
  51.   # ● 通常攻撃の効果適用
  52.   #--------------------------------------------------------------------------
  53.   alias attack_effect_KGC_Invincible attack_effect
  54.   def attack_effect(attacker)
  55.     # 無敵状態の場合
  56.     if self.invincible?
  57.       effective=true
  58.       # ダメージに "Miss" を設定
  59.       self.damage = "Miss"
  60.       # クリティカルフラグをクリア
  61.       self.critical = false
  62.       effective |= states_plus(attacker.plus_state_set)
  63.       effective |= states_minus(attacker.minus_state_set)
  64.       return effective
  65.     end
  66.  
  67.     # 元の処理を実行
  68.     return attack_effect_KGC_Invincible(attacker)
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● スキルの効果適用
  72.   #--------------------------------------------------------------------------
  73.   alias skill_effect_KGC_Invincible skill_effect
  74.   def skill_effect(user, skill)
  75.     # 無敵状態の場合
  76.     if self.invincible?(skill)
  77.       effective=true
  78.       # ダメージに "Miss" を設定
  79.       self.damage = "Miss"
  80.       # クリティカルフラグをクリア
  81.       self.critical = false
  82.       effective |= states_plus(skill.plus_state_set)
  83.       effective |= states_minus(skill.minus_state_set)
  84.       return effective
  85.     end
  86.  
  87.     # 元の処理を実行
  88.     return skill_effect_KGC_Invincible(user, skill)
  89.   end
  90.   #--------------------------------------------------------------------------
  91.   # ● アイテムの効果適用
  92.   #--------------------------------------------------------------------------
  93.   alias item_effect_KGC_Invincible item_effect
  94.   def item_effect(item)
  95.     # 無敵状態の場合
  96.     if self.invincible?(item)
  97.       effective=true
  98.       # ダメージに "Miss" を設定
  99.       self.damage = "Miss"
  100.       # クリティカルフラグをクリア
  101.       self.critical = false
  102.       effective |= states_plus(item.plus_state_set)
  103.       effective |= states_minus(item.minus_state_set)
  104.       return effective
  105.     end
  106.  
  107.     # 元の処理を実行
  108.     return item_effect_KGC_Invincible(item)
  109.   end
  110. end


之后给攻击技能解除状态打勾就行
无忧谷主幻 发表于 4 天前
soulsaga 发表于 2025-9-2 06:39
class Scene_Battle  
  attr_accessor :active_battler
  attr_accessor :target_battlers

然后如何用条件分歧给刚刚攻击的目标附加或解除状态?
soulsaga 发表于 4 天前
RUBY 代码复制
  1. class Scene_Battle  
  2.   attr_accessor :active_battler
  3.   attr_accessor :target_battlers
  4. end


插入这个后
在事件用$scene.target_battlers[0]
就是你单体攻击的目标
魔法丶小肉包 发表于 5 天前
无忧谷主幻 发表于 2025-8-31 22:55
呃,这样的话其他增益状态都无法附加上了

如果直接施加无敌状态,有时候就会报错(也有时候暂时不报错, ...

忘记考虑角色不拿武器的情况了,改成这样
RUBY 代码复制
  1. class Game_Battler
  2.   def add_state_nonresistance(target,item)
  3.     return unless item
  4.     nonresistance = item.plus_state_set.select {|id| $data_states[id].nonresistance}
  5.     target.states_plus nonresistance
  6.   end
  7. end
无忧谷主幻 发表于 5 天前
soulsaga 发表于 2025-9-1 02:04
照道理这个可能用事件就能解除

如果使用是单体技能,那么系统并不知道你刚刚攻击的是谁
至于靠状态法判断,首先要挂的上状态
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

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

GMT+8, 2025-9-6 07:51

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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