• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] Synchronize strange things

12
Posts
231
Days
  • Age 28
  • Seen today
I am making Synchronize pass frozen and sleep, but burn, poison and para can work, frozen and sleep cant.
I have been checked many times, i cant figure out what i missing. it really really sucks, im tired about that. May someone can help. Many many thanks.
Ruby:
# Changed by EEE 04-04-2024
Battle::AbilityEffects::OnStatusInflicted.add(:SYNCHRONIZEER,
  proc { |ability, battler, user, status|
    next if !user || user.index == battler.index
    case status
    when :POISON
      if user.pbCanPoisonSynchronize?(battler)
        battler.battle.pbShowAbilitySplash(battler)
        msg = nil
        if !Battle::Scene::USE_ABILITY_SPLASH
          msg = _INTL("{1}'s {2} poisoned {3}!", battler.pbThis, battler.abilityName, user.pbThis(true))
        end
        user.pbPoison(nil, msg, (battler.statusCount > 0))
        battler.battle.pbHideAbilitySplash(battler)
      end
    when :BURN
      if user.pbCanBurnSynchronize?(battler)
        battler.battle.pbShowAbilitySplash(battler)
        msg = nil
        if !Battle::Scene::USE_ABILITY_SPLASH
          msg = _INTL("{1}'s {2} burned {3}!", battler.pbThis, battler.abilityName, user.pbThis(true))
        end
        user.pbBurn(nil, msg)
        battler.battle.pbHideAbilitySplash(battler)
      end
    when :PARALYSIS
      if user.pbCanParalyzeSynchronize?(battler)
        battler.battle.pbShowAbilitySplash(battler)
        msg = nil
        if !Battle::Scene::USE_ABILITY_SPLASH
          msg = _INTL("{1}'s {2} paralyzed {3}! It may be unable to move!",
             battler.pbThis, battler.abilityName, user.pbThis(true))
        end
        user.pbParalyze(nil, msg)
        battler.battle.pbHideAbilitySplash(battler)
      end
    when :SLEEP
      if user.pbCanSleepSynchronize?(battler)
        battler.battle.pbShowAbilitySplash(battler)
        msg = nil
        if !Battle::Scene::USE_ABILITY_SPLASH
          msg = _INTL("{1}'s {2} made {3} fall asleep!",
             battler.pbThis, battler.abilityName, user.pbThis(true))
        end
        user.pbSleep(msg)
        battler.battle.pbHideAbilitySplash(battler)
      end
    when :FROZEN
      if user.pbCanFreezeSynchronize?(battler)
        battler.battle.pbShowAbilitySplash(battler)
        msg = nil
        if !Battle::Scene::USE_ABILITY_SPLASH
          msg = _INTL("{1}'s {2} frozen {3}!",
             battler.pbThis, battler.abilityName, user.pbThis(true))
        end
        user.pbFreeze(msg)
        battler.battle.pbHideAbilitySplash(battler)
      end
    end
  }
)


  # Changed by EEE 04-04-2024
  def pbCanSleepSynchronize?(target)
    return pbCanSynchronizeStatus?(:SLEEP, target)
  end
    
  # Changed by EEE 04-04-2024
  def pbCanFreezeSynchronize?(target)
    return pbCanSynchronizeStatus?(:FROZEN, target)
  end

  #def pbCanSynchronizeStatus?(newStatus, target)
  def pbCanSynchronizeStatus?(newStatus, user) # Changed by EEE 03-17-2024
    return false if fainted?
    # Trying to replace a status problem with another one
    return false if self.status != :NONE
    # Terrain immunity
    return false if @battle.field.terrain == :Misty && affectedByTerrain?
    # Type immunities
    hasImmuneType = false
    case newStatus
    when :POISON
      # NOTE: target will have Synchronize, so it can't have Corrosion.
      #if !(target && target.hasActiveAbility?(:CORROSION))
      if !(user && user.hasActiveAbility?([:CORROSION, :CORROSIONER])) # Changed by EEE 03-17-2024
        hasImmuneType |= pbHasType?(:POISON)
        hasImmuneType |= pbHasType?(:STEEL)
      end
    when :BURN
      hasImmuneType |= pbHasType?(:FIRE)
    when :PARALYSIS
      if !(user && user.hasActiveAbility?(:OVERCHARGEER)) # Changed by EEE 04-01-2024
        hasImmuneType |= pbHasType?(:ELECTRIC) && Settings::MORE_TYPE_EFFECTS
      end
    when :SLEEP # Changed by EEE 04-04-2024
      # No type is immune to sleep
    when :FROZEN # Changed by EEE 04-04-2024
      hasImmuneType |= pbHasType?(:ICE)
    end
    return false if hasImmuneType
    # Ability immunity
    if Battle::AbilityEffects.triggerStatusImmunityNonIgnorable(self.ability, self, newStatus)
      return false
    end
    if abilityActive? && Battle::AbilityEffects.triggerStatusImmunity(self.ability, self, newStatus)
      return false
    end
    allAllies.each do |b|
      next if !b.abilityActive?
      next if !Battle::AbilityEffects.triggerStatusImmunityFromAlly(b.ability, self, newStatus)
      return false
    end
    # Safeguard immunity
    # NOTE: user will have Synchronize, so it can't have Infiltrator. # Changed by EEE 03-17-2024
    if pbOwnSide.effects[PBEffects::Safeguard] > 0 &&
       !(user && user.hasActiveAbility?(:INFILTRATOR))
      return false
    end
    return true
  end
 
Back
Top