Hand Over De-Buffs ACE
#1
Hand Over De-Buffs ACE

by Kyonides Arkanthes


Introduction

Thinking I think that the title is quite suggestive so I will simply leave the code below for you to use.

It also includes the notes you will need to leave at the skills' noteboxes to make the script work as intended.

You can only leave 1 of those 3 notes at any given time!

Code:
# * Hand Over De-Buffs ACE * #
#   Scripter : Kyonides Arkanthes
#   2022-12-16

# * Instructions:
# Leave a skill note like the following:
# <handover buffs> or <handover debuffs> or <handover all buffs>
# You can only leave 1 of those 3 notes at any given time!

class Game_Battler
  REGEX_BUFFS = /<handover buffs>/i
  REGEX_DEBUFFS = /<handover debuffs>/i
  REGEX_DE_BUFFS = /<handover all buffs/i
  attr_reader :buffs, :buff_turns
  alias :kyon_de_buffs_gm_btlr_iue :item_user_effect
  def item_user_effect(user, item)
    kyon_de_buffs_gm_btlr_iue(user, item)
    return if
    if item.note[REGEX_BUFFS]
      hand_over_buffs(user)
    elsif item.note[REGEX_DEBUFFS]
      hand_over_debuffs(user)
    elsif item.note[REGEX_DE_BUFFS]
      hand_over_all_buffs(user)
    end
  end

  def clear_buff(pos)
    @buffs[pos] = 0
    @buff_turns.delete(pos)
  end

  def hand_over_buffs(user)
    user.buff_turns.keys.sort.each do |n|
      next if user.buffs[n] < 0
      @buffs = user.buffs[n]
      @buff_turns = user.buff_turns[n]
      user.clear_buff(n)
      @result.added_buffs.push(n).uniq!
    end
    user.refresh
    refresh
    @result.success = true
  end

  def hand_over_debuffs(user)
    user.buff_turns.keys.sort.each do |pos|
      next if user.buffs[pos] >= 0
      @buffs[pos] = user.buffs[pos]
      @buff_turns[pos] = user.buff_turns[pos]
      user.clear_buff(pos)
      @result.added_debuffs.push(pos).uniq!
    end
    user.refresh
    refresh
    @result.success = true
  end

  def hand_over_all_buffs(user)
    @buffs = user.buffs.dup
    @buff_turns = user.buff_turns.dup
    @buffs.size.times do |pos|
      if user.buffs[pos] > 0
        @result.added_buffs.push(n).uniq!
      else
        @result.added_debuffs.push(pos).uniq!
      end
    end
    user.clear_buffs
    user.refresh
    refresh
    @result.success = true
  end
end


Terms & Conditions

Free for use in ANY kind of game. Grinning
Please include my nickname in your game credits!
I would love to see that this is not the only script of mine that you are using there. Laughing

Just in case one of your nicknames is Dog Wulfo, let me tell you that Ramen is bad for your diet.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
#2
The Code Has Been Rewritten! Shocked

Based on my lastest test runs, trying to apply the effect as a damage formula was a NO GO. Sad
Thus, I was in dire need of looking for an alternate way to solve this issue.
Grinning And I finally found it!

I simply needed to define it as Skill Notes and let the game apply any of them as an Item Effect.
By default, the item effects only run IF there was a hit or successful attempt to cast the spell on the target.
That means that I had no reason to worry about that at all! Two Thumbs Up!
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }




Users browsing this thread: 2 Guest(s)