So, I found an awesome mini script in an old post that allow you to use a script call in damage formulas to remove 1 random state that has a special tag on the state box.
The mini script works perfectly!
But there's a little problem, I'm also using a script that make that the same stats can be stacked. The problem with the mini script, is that it erase all stacks of a same state. Is there some way to fix the script to make it only erase 1 stack of a same state?
The mini script works perfectly!
Ruby:
class RPG::State < RPG::BaseItem
def neg_state?
self.note =~ /<neg>/i
end
end
class Game_Battler < Game_BattlerBase
def remove_random_state
return if neg_states_and_debuffs.empty?
state_id = neg_states_and_debuffs.sample
state_id.is_a?(Array) ? remove_buff(state_id[0]) : remove_state(state_id)
end
def neg_states_and_debuffs
debuffs = Hash[@buffs.map.with_index { |x,i| [i,x] }]
debuffs = (debuffs.select { |k,v| v < 0 }).to_a
return @states.select { |s| $data_states[s].neg_state? } + debuffs
end
end
But there's a little problem, I'm also using a script that make that the same stats can be stacked. The problem with the mini script, is that it erase all stacks of a same state. Is there some way to fix the script to make it only erase 1 stack of a same state?
