• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • 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] New Status Effect : Disease

  • 22
    Posts
    8
    Years
    • Seen May 15, 2023
    Hi, I am trying to implement Disease as a new Status Effect. Mainly, I have achieved almost everything.

    A Pokemon suffering from Disease will take damage each time it uses a move of a type different than either of its two types. But the movement in question will still take place.

    The point is I have successfully implemented the new status effect, but I have not managed to create a movement capable of causing it.
    I can't find the cause of the problem.
    If I manually set the Disease status with the Debug menu, so I can check it, once in the battle, and it's working just as I want.

    This is for v. 17.2
    Here is the most important code parts, I mostly used a variation of the Freeze code:

    PBStatuses

    Code:
      module PBStatuses
        SLEEP     = 1
        POISON    = 2
        BURN      = 3
        PARALYSIS = 4
        FROZEN    = 5
        BLEED     = 6
        ENFERMO   = 7
    
        def PBStatuses.getName(id)
          names = [
             _INTL("saludable"),
             _INTL("dormido"),
             _INTL("envenenado"),
             _INTL("quemado"),
             _INTL("paralizado"),
             _INTL("congelado"),
             _INTL("sangrando"),
             _INTL("enfermo")
          ]
          return names[id]
        end
      end

    PokeBattle_Battler
    Below the code of Freeze
    Code:
    if self.status==PBStatuses::ENFERMO
          if thismove.canCurEnfUser?
            PBDebug.log("[Move effect triggered] #{pbThis} se recuperó usando #{thismove.name}")
            self.pbCureStatus(false)
            @battle.pbDisplay(_INTL("¡{1} curó la enfermedad!",pbThis))
            pbCheckForm
          elsif @battle.pbRandom(10)<1 && !turneffects[PBEffects::SkipAccuracyCheck]
            self.pbCureStatus
            pbCheckForm
          elsif !thismove.canCurEnfUser?
            self.pbContinueStatus
            PBDebug.log("[Status] #{pbThis} permanece enfermo")
            if ((thismove.type)!=(self.type1) && (thismove.type)!=(self.type2))
            pbEnfermoDamage
            @battle.pbDisplay(_INTL("¡#{pbThis} recibió daño de la enfermedad!")) 
            PBDebug.log("[Status] La enfermedad causó daño a #{pbThis}")
            return true if !self.isFainted?
            return false if self.isFainted?
            end
            #return false
          end
        end

    PokeBattle_BattlerEffects
    Below the code of Freeze
    Code:
    #===============================================================================
    # Enfermo
    #===============================================================================
      def pbCanEnfermo?(attacker,showMessages,move=nil)
        return false if fainted?
        if status==PBStatuses::ENFERMO
          @battle.pbDisplay(_INTL("¡{1} ya está Enfermo!",pbThis)) if showMessages
          return false
        end
        if self.status!=0 || hasWorkingAbility(:COMATOSE) ||
           (@effects[PBEffects::Substitute]>0 && (!move || !move.ignoresSubstitute?(attacker))) ||
           @battle.pbWeather==PBWeather::ECLIPSE
          @battle.pbDisplay(_INTL("¡Pero falló!")) if showMessages
          return false
        end
        if !hasWorkingItem(:RINGTARGET)
          @battle.pbDisplay(_INTL("No afecta a {1}...",pbThis(true))) if showMessages
          return false
        end
        if @battle.field.effects[PBEffects::MistyTerrain]>0 &&
           !self.isAirborne?(attacker && attacker.hasMoldBreaker)
          @battle.pbDisplay(_INTL("¡El Terreno Místico evitó que {1} se enfermara!",pbThis(true))) if showMessages
          return false
        end
        if !attacker || !attacker.hasMoldBreaker
          if hasWorkingAbility(:MICROINMUNE) ||
             (hasWorkingAbility(:FLOWERVEIL) && pbHasType?(:GRASS)) ||
           (hasWorkingAbility(:SPRITEARMOR) && pbHasType?(:FAIRY)) ||
             (hasWorkingAbility(:LEAFGUARD) && (@battle.pbWeather==PBWeather::SUNNYDAY || @battle.pbWeather==PBWeather::HARSHSUN || 
             @battle.pbWeather==PBWeather::BLISTERINGSUN))
            @battle.pbDisplay(_INTL("¡{2} de {1} evita la enfermedad!",pbThis,PBAbilities.getName(self.ability))) if showMessages
            return false
          end
          if pbPartner.hasWorkingAbility(:FLOWERVEIL) && pbHasType?(:GRASS)
            abilityname=PBAbilities.getName(pbPartner.ability)
            @battle.pbDisplay(_INTL("¡{2} del compañero de {1} evita la enfermedad!",pbThis,abilityname)) if showMessages
            return false
          end
          if pbPartner.hasWorkingAbility(:SPRITEARMOR) && pbHasType?(:FAIRY)
            abilityname=PBAbilities.getName(pbPartner.ability)
            @battle.pbDisplay(_INTL("¡{2} del compañero de {1} evita la enfermedad!",pbThis,abilityname)) if showMessages
            return false
          end
        end
        if pbOwnSide.effects[PBEffects::Safeguard]>0 &&
           (!attacker || !attacker.hasWorkingAbility(:INFILTRATOR))
          @battle.pbDisplay(_INTL("¡El equipo de {1} está protegido por Salvaguarda!",pbThis)) if showMessages
          return false
        end
        return true
      end
      
      def pbEnfermo(msg=nil)
        self.status=PBStatuses::ENFERMO
        self.statusCount=0
        #pbCancelMoves
        @battle.pbCommonAnimation("Enfermo",self,nil)
        if msg && msg!=""
          @battle.pbDisplay(msg)
        else
          @battle.pbDisplay(_INTL("¡{1} contrajo una enfermedad!",pbThis))
        end
        PBDebug.log("[Status change] #{pbThis} enfermó")
      end

    PokeBattle_MoveEffects
    Code:
    ################################################################################
    # Disease for the target.
    ################################################################################
    class PokeBattle_Move_1F2 < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        return super(attacker,opponent,hitnum,alltargets,showanimation) if pbIsDamaging?
        return -1 if !opponent.pbCanEnfermo?(attacker,true,self)
        pbShowAnimation(@id,attacker,opponent,hitnum,alltargets,showanimation)
        opponent.pbEnfermo
        return 0
      end
    
      def pbAdditionalEffect(attacker,opponent)
        return if opponent.damagestate.substitute
        if opponent.pbCanEnfermo?(attacker,false,self)
          opponent.pbEnfermo
        end
      end
    end

    PBS/Moves.txt
    Code:
    xxx,AROMAFUNGICO,Aroma Fúngico,1F2,20,POISON,Special,100,30,100,08,0,bef,"Expande rápidamente un aroma fúngico que causa malestar a todos a su alrededor, provocando que enfermen (100%)."

    There are other minor additions to the code, but I think these are the most important.
    I need help to get a move causing the Disease (Enfermo) status successfully.
     
    Back
    Top