View Single Post
  #12    
Old September 5th, 2012 (4:18 AM).
Maruno's Avatar
Maruno Maruno is offline
Lead Dev of Pokémon Essentials
     
    Join Date: Jan 2008
    Location: England
    Posts: 5,171
    Code:
    class PokeBattle_Move_141 < PokeBattle_Move
      def pbEffect(attacker,opponent)
        ret=super(attacker,opponent)
        if opponent.damagestate.calcdamage>0
          attacker.effects[PBEffects::HyperBeam]=2
          [email protected]
        end
        return ret
        haveanim=false
        if !attacker.pbTooHigh?(PBStats::ATTACK)
          attacker.stages[PBStats::ATTACK]+=1
          @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
          @battle.pbDisplay(_INTL("{1}'s Attack rose!",attacker.pbThis))
        end
        if !attacker.pbTooHigh?(PBStats::DEFENSE)
          attacker.stages[PBStats::DEFENSE]+=1
          @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
          @battle.pbDisplay(_INTL("{1}'s Defense rose!",attacker.pbThis))
        end
        if !attacker.pbTooHigh?(PBStats::SPEED)
          attacker.stages[PBStats::SPEED]+=1
          @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
          @battle.pbDisplay(_INTL("{1}'s Speed rose!",attacker.pbThis))
        end
        if !attacker.pbTooHigh?(PBStats::SPATK)
          attacker.stages[PBStats::SPATK]+=1
          @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
          @battle.pbDisplay(_INTL("{1}'s Special Attack rose!",attacker.pbThis))
        end
        if !attacker.pbTooHigh?(PBStats::SPDEF)
          attacker.stages[PBStats::SPDEF]+=1
          @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
          @battle.pbDisplay(_INTL("{1}'s Special Defense rose!",attacker.pbThis))
        end
        if !attacker.pbTooHigh?(PBStats::ACCURACY)
          attacker.stages[PBStats::ACCURACY]+=1
          @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
          @battle.pbDisplay(_INTL("{1}'s Accuracy rose!",attacker.pbThis))
        end
        if !attacker.pbTooHigh?(PBStats::EVASION)
          attacker.stages[PBStats::EVASION]+=1
          @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
          @battle.pbDisplay(_INTL("{1}'s Evasion rose!",attacker.pbThis))
        end
        return true
      end
    end
    Delete the red line, add the green line.


    Code:
    class PokeBattle_Move_148 < PokeBattle_Move
      def pbAdditionalEffect(attacker,opponent)
        [email protected](10)
        case rnd
          when 0
            return false if !opponent.pbCanBurn?(true)
            opponent.pbBurn(attacker)
            @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
          when 1
            return false if !opponent.pbCanFreeze?(true)
            opponent.pbFreeze
            @battle.pbDisplay(_INTL("{1} was frozen solid!",opponent.pbThis))
          when 2
            return false if !opponent.pbCanParalyze?(true)
            opponent.pbParalyze(attacker)
            @battle.pbDisplay(_INTL("{1} is paralyzed!  It may be unable to move!",opponent.pbThis))
          when 3
            return false if !opponent.pbCanPoison?(true)
            opponent.pbPoison(attacker)
            @battle.pb.Display(_INTL("{1} was poisoned!",opponent.pbThis))
          when 4
            return false if !opponent.pbCanSleep?(true)
            opponent.pbSleep
            @battle.pbDisplay(_INTL("{1} went to sleep!",opponent.pbThis))
          when 5
            return false if !opponent.pbCanBurn?(true)
            opponent.pbBurn(attacker)
            @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
          when 6
            return false if !opponent.pbCanSleep?(true)
            opponent.pbSleep
            @battle.pbDisplay(_INTL("{1} went to sleep!",opponent.pbThis))
          when 7
            return false if !opponent.pbCanParalyze?(true)
            opponent.pbParalyze(attacker)
            @battle.pbDisplay(_INTL("{1} is paralyzed!  It may be unable to move!",opponent.pbThis))
          when 8
            return false if !opponent.pbCanPoison?(true)
            opponent.pbPoison(attacker)
            @battle.pb.Display(_INTL("{1} was poisoned!",opponent.pbThis))
          when 9
            return false if !opponent.pbCanSleep?(true)
            opponent.pbSleep
            @battle.pbDisplay(_INTL("{1} went to sleep!",opponent.pbThis))
        end
        return true
      end
    end
    Fix the extraneous dot in the red part. Other than that, though, the code itself is correct. Make sure the move as defined in moves.txt has an additional effect probability of [whatever] rather than 0 (maybe 30?).
    __________________
    Go to the Pokémon Essentials Wiki

    | Downloads | Tutorials | Fangames |
    | All Animations Project |

    Follow me on Twitter: @maruno42


    Reply With Quote