State that Resists/Immune to Buffs and Debuffs

Hello, everybody!


Is there any way to make a state that makes a battler immune to buffs and debuffs?


No, not state, but the buffs and debuffs from the "Add Buff" command from the Effects part in the Skills tab.


Because I'm making a state that pretty much avoids everything including buffs and debuffs. Thanks. 
are you using yanflys buffs & states core?


If yes, replay and I will figure out the code for you 🙂
are you using yanflys buffs & states core?


If yes, replay and I will figure out the code for you 🙂

I'm using Yanfly Engine Ace - Buff & State Manager v1.07 


Seems like Buffs and States Core is for MV 😀
Oh, I am sorry, didn't see you are using RMVXA, I am only familiar with RMV...


But my approach would have been a state that (if that works with the ace script) has a formular like

if (target.isBuffAffected(paramId)) {


target.atk -= target.paramPlus(paramId); 


}

but I think this won't be that easy because RMV uses javascript and RMVXA ruby...


Hope I could help you nevertheless...
I think it can be done with a really complex engine. I can explain if you don't find any script.


Another option that involves Tsukihime's Battle Reactions: http://himeworks.com/2013/09/battle-reactions/


Make a skill that removes buffs and debuffs from the user. Then make a state that reacts to buffs and debuffs with that skill.
I found this much easier to code myself.

Spoiler
#==============================================================================
# ** Resist Buff State Module
#------------------------------------------------------------------------------
#  Set the ID of the state(s) that will resist buffs and/or debuffs.
#==============================================================================
module RINOBI module RB_State
  Buff_Resist   = [1, 2, 5, 9]
  Debuff_Resist = [1, 2, 5, 9]
end end
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  A battler class with methods for sprites and actions added. This class 
# is used as a super class of the Game_Actor class and Game_Enemy class.
#==============================================================================
class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # * Alias Method: Add Buff
  #--------------------------------------------------------------------------
  alias :rb_add_buff :add_buff
  def add_buff(param_id, turns)
    rb = RINOBI::RB_State::Buff_Resist
    return if states.any? {|state| rb.include?(state.id)}
    rb_add_buff(param_id, turns)
  end
  #--------------------------------------------------------------------------
  # * Alias Method: Add Debuff
  #--------------------------------------------------------------------------
  alias :rb_add_debuff :add_debuff
  def add_debuff(param_id, turns)
    rb = RINOBI::RB_State:😀ebuff_Resist
    return if states.any? {|state| rb.include?(state.id)}
    rb_add_debuff(param_id, turns)
  end
end
Thanks both of you! I'll see what I can do..


@xdan how exactly the buff removal works? Does it only remove 1 buff stage or does it remove all  stages?


For example Actor A has his Attack buffed 3 times (3 stages)


Then when I remove buff for Attack, does it became 2 stages or it became 0 stages (Attack buffs completely removed)? 
I found this much easier to code myself.

Spoiler
#==============================================================================
# ** Resist Buff State Module
#------------------------------------------------------------------------------
#  Set the ID of the state(s) that will resist buffs and/or debuffs.
#==============================================================================
module RINOBI module RB_State
  Buff_Resist   = [1, 2, 5, 9]
  Debuff_Resist = [1, 2, 5, 9]
end end
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  A battler class with methods for sprites and actions added. This class 
# is used as a super class of the Game_Actor class and Game_Enemy class.
#==============================================================================
class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # * Alias Method: Add Buff
  #--------------------------------------------------------------------------
  alias :rb_add_buff :add_buff
  def add_buff(param_id, turns)
    rb = RINOBI::RB_State::Buff_Resist
    return if states.any? {|state| rb.include?(state.id)}
    rb_add_buff(param_id, turns)
  end
  #--------------------------------------------------------------------------
  # * Alias Method: Add Debuff
  #--------------------------------------------------------------------------
  alias :rb_add_debuff :add_debuff
  def add_debuff(param_id, turns)
    rb = RINOBI::RB_State:😀ebuff_Resist
    return if states.any? {|state| rb.include?(state.id)}
    rb_add_debuff(param_id, turns)
  end
end

Thanks Rinobi!! It seems to work!


(Sorry for double posting but I just had to say thanks)
Kevin Eontrainer, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


What you do is click on the edit button of your last post and add what you want to say.


So can this be closed as solved?
Thanks both of you! I'll see what I can do..


@xdan how exactly the buff removal works? Does it only remove 1 buff stage or does it remove all  stages?


For example Actor A has his Attack buffed 3 times (3 stages)


Then when I remove buff for Attack, does it became 2 stages or it became 0 stages (Attack buffs completely removed)? 



It removes all stages. Somebody wrote some script for this thought.
@xdan Yeah the script worked fine till now. Thanks for trying to help.


@ksjp17 yeah.. like this, right?
Yes, like that.
Yes, like that.

This thread can be closed btw.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/state-that-resists-immune-to-buffs-and-debuffs.68970/