Relic Castle

I am working on implementing a new move that I have created, and have been running into some errors with the scripting of the effect. Wondering if anyone with more knowledge of scripting/code can help identify my errors?

Basically, the move functions the same as Absorb (deals damage, heals user up to 50% of damage dealt). However, if your opponent is Lotad, Lombre, or Ludicolo, the move will be a OHKO. To get the basis for the move effect code, I copied parts from the OHKO effect (guillotine, fissure, etc.) and also parts from Absorb's effect for the "else" bit.

I keep getting errors when trying to play test the game. Some syntax errors, and also a problem with the definition of "opponent" that I can't seem to figure out.

Here is what my code looks like so far in PokeBattle_MoveEffects:

Code:
class PokeBattle_Move_161 < PokeBattle_Move
 if isConst?(opponent.species,PBSpecies,:LOTAD,:LOMBRE,:LUDICOLO) 
  def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    damage=pbEffectFixedDamage(opponent.totalhp,attacker,opponent,hitnum,alltargets,showanimation)
    if opponent.fainted?
      @battle.pbDisplay(_INTL("It's a one-hit KO!"))
    end
    return damage
  end
  else
    def isHealingMove?
      return USENEWBATTLEMECHANICS
    end

    def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
      ret=super(attacker,opponent,hitnum,alltargets,showanimation)
      if opponent.damagestate.calcdamage>0
        hpgain=(opponent.damagestate.hplost/2).round
        if opponent.hasWorkingAbility(:LIQUIDOOZE)
          attacker.pbReduceHP(hpgain,true)
          @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",attacker.pbThis))
        elsif attacker.effects[PBEffects::HealBlock]==0
          hpgain=(hpgain*1.3).floor if attacker.hasWorkingItem(:BIGROOT)
          attacker.pbRecoverHP(hpgain,true)
          @battle.pbDisplay(_INTL("{1} had its energy drained!",opponent.pbThis))
        end
      end
      return ret
    end
  end
end

Any help is greatly appreciated!!
Top