[XP] Demi Skills Script problem

i have the Demi Skills Script from Tons of Add-ons,
and when i have a skill that assigned with an element and as a demi skill
and when the enemy has an element that blocks (or absorb) from a specific element,
the demi skill script bypasses it
example:
i used a Dark element demi skill
and the enemy is Immune to Dark
and when i use the Dark element demi skill on that enemy
the script bypasses the elemental affinity.
any way to make Demi Skills NOT op for boss fights?
Within the Demi Skill script, replace Game_Battler with this:
Code:
class Game_Battler
  
  alias skill_effect_demi_skill_later skill_effect
  def skill_effect(user, skill)
    last_hp = self.hp
    last_sr = self.sr if $crls && self.is_a?(Game_Actor)
    result = skill_effect_demi_skill_later(user, skill)
    
    if result && elements_correct(skill.element_set) <= 0
      self.damage = "No effect!"
    else
      if $game_system.DEMI_SKILL
        rate = BlizzCFG.demi_database(skill.id)
        if rate != 0
          self.hp = last_hp
          self.hp = self.hp
          self.sr = last_sr if $crls && self.is_a?(Game_Actor)
          if result || self.damage.is_a?(Numeric)
            self.damage = last_hp * rate / 100
            self.hp -= self.damage
          end
        end
      end
    end
    return result
  end
  
end
it works, thanks!
Actually, looking back at this again, I made a mistake with the logic. For example, if you made any elemental non-Demi skill that the target can absorb, it will always say "No effect" rather than healing them.

This will check that a Demi skill is being used first, then check if the battler is immune/absorbs the element.
Code:
class Game_Battler
  
  alias skill_effect_demi_skill_later skill_effect
  def skill_effect(user, skill)
    last_hp = self.hp
    last_sr = self.sr if $crls && self.is_a?(Game_Actor)
    result = skill_effect_demi_skill_later(user, skill)
    if $game_system.DEMI_SKILL
      rate = BlizzCFG.demi_database(skill.id)
      if rate != 0
        if result && elements_correct(skill.element_set) <= 0
          self.damage = "No effect!"
        else
          self.hp = last_hp
          self.hp = self.hp
          self.sr = last_sr if $crls && self.is_a?(Game_Actor)
          if result || self.damage.is_a?(Numeric)
            self.damage = last_hp * rate / 100
            self.hp -= self.damage
          end
        end
      end
    end
    return result
  end
  
end
nice for looking that mistake that i didn't tested earlier
(btw is there a way to make demi skills to do damage of the battler's MAX HP instead of CURRENT HP as a seperate type?)
I'd assume something like this
Code:
#==============================================================================
# module BlizzCFG
#==============================================================================

module BlizzCFG
 
  def self.demi_database(id)
    case id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Demi Database
#
#   Use following template to create Demi skills:
#
#     when ID then return RATE
#
#   ID   - ID of the skill in the database
#   RATE - percentage of how much of the remaining HP should be taken away
#
#   Example:
#
#     when 88 then return 25
#  
#   Skill with ID 88 will do damage equal to 25% of the enemies' remaining HP.
#
#   Note that using values equal to or greater than 100 will kill instantly.
#   Negative values will heal instead.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    when 88 then return 25
    when 89 then return 50
    when 58 then return 50
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Demi Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return 0
  end
 
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# Define which skill IDs will use the enemy's Max HP value instead of their
# current HP (e.g. a skill that does 25% damage will kill a target after 4 uses)
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  DEMI_USE_MAX_HP = [88, 89]
 
end

#==============================================================================
# Game_Battler
#==============================================================================

class Game_Battler
 
  alias skill_effect_demi_skill_later skill_effect
  def skill_effect(user, skill)
    last_hp = self.hp
    last_sr = self.sr if $crls && self.is_a?(Game_Actor)
    result = skill_effect_demi_skill_later(user, skill)
   
    if $game_system.DEMI_SKILL
      rate = BlizzCFG.demi_database(skill.id)
      if rate != 0
        if result && elements_correct(skill.element_set) <= 0
          self.damage = "No effect!"
        else
          self.hp = last_hp
          self.hp = self.hp
          self.sr = last_sr if $crls && self.is_a?(Game_Actor)
          if result || self.damage.is_a?(Numeric)
            val = BlizzCFG::DEMI_USE_MAX_HP.include?(skill.id) ? self.maxhp : last_hp
            self.damage = val * rate / 100
            self.hp -= self.damage
          end
        end
      end
    end
    return result
  end
 
end
Just add whatever skill IDs to the array defined in DEMI_USE_MAX_HP
works like a charm, thanks! :ahappy:

Original thread: https://forums.rpgmakerweb.com/threads/xp-demi-skills-script-problem.123642/