• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Eevee Expo's webhost has been having technical issues since Nov. 20th and you might be unable to connect to our site. Staff are also facing issues connecting, so please send a DM to Cat on-site or through Discord directly for faster service!

Custom move - Need help!

Cainjeman

Rookie
Member
Joined
Mar 18, 2024
Posts
2
The move in question (which I've found out is quite convoluted) is as follows:
user launches an aerial bombardment, which effects the foe's side
At the end of the next 5 rounds (including the one it was used), the opponents take damage based on user's attack stat.
I've tried to combine code from Future Sight and the entry hazards to make this work.

I've gotten all of the stuff updated in the PBEffects, Battle, MoveEffects_Custom (I made a new section for this), and Battle_EndOfRoundPhase (Including putting the pbEORAerialBombardment in the End of Round phase processing)

Here is the main code in Battle_EndOfRoundPhase:
Ruby:
Expand Collapse Copy
def pbEORAerialBombardment(position, position_index)
    moveUser = nil
    2.times do |side|
      next if sides[side].effects[PBEffects::AerialAssaultCounter] == 0
      sides[side].effects[PBEffects::AerialAssaultCounter] -= 1
        if sides[side].effects[PBEffects::AerialAssaultCounter] == 0
        pbDisplay(_INTL("The Aerial Bombardment around {1} Ended!", @battlers[side].pbTeam))
        position.effects[PBEffects::AerialAssaultMove]           = nil
        position.effects[PBEffects::AerialAssaultUserIndex]      = -1
        position.effects[PBEffects::AerialAssaultPartyIndex] = -1
        end
      next if sides[side].effects[PBEffects::AerialAssaultCounter] == 0
    end
    allBattlers.each do |battler|
      next if battler.opposes?(position.effects[PBEffects::AerialAssaultUserIndex])
      next if battler.pokemonIndex != position.effects[PBEffects::AerialAssaultPartyIndex]
      moveUser = battler
      break
    end
    return if moveUser && moveUser.index == position_index   # Target is the user
    if !moveUser   # User isn't in battle, get it from the party
      party = pbParty(position.effects[PBEffects::AerialAssaultUserIndex])
      pkmn = party[position.effects[PBEffects::AerialAssaultPartyIndex]]
      if pkmn&.able?
        moveUser = Battler.new(self, position.effects[PBEffects::AerialAssaultUserIndex])
        moveUser.pbInitDummyPokemon(pkmn, position.effects[PBEffects::AerialAssaultPartyIndex])
      end
    end
    move = :AERIALASSAULT
    pbDisplay(_INTL("{1} is hit by the aerial bombardment!", @battlers[position_index].pbThis))
    userLastMoveFailed = moveUser.lastMoveFailed
    @aerialAssault = true
    moveUser.pbUseMoveSimple(move, position_index)
    @aerialAssault = false
    moveUser.lastMoveFailed = userLastMoveFailed
    @battlers[position_index].pbFaint if @battlers[position_index].fainted?
   end
end

and here is the code from BattleEffects_Custom:
Ruby:
Expand Collapse Copy
class Battle::Move::AerialAssault < Battle::Move
# Stops damage being dealt in the setting-up turn.
  def pbDamagingMove?
    return false if !@battle.aerialAssault
    return super
  end

  def pbAccuracyCheck(user, target)
    return true if !@battle.aerialAssault
    return super
  end

  def pbDisplayUseMessage(user)
    super if !@battle.aerialAssault
  end

  def pbEffectGeneral(user)
    user.pbOpposingSide.effects[PBEffects::AerialAssaultCounter] = 5
    effects = @battle.positions[user.index].effects
    effects[PBEffects::AerialAssaultUserIndex]      = user.index
    effects[PBEffects::AerialAssaultPartyIndex]     = user.pokemonIndex
    @battle.pbDisplay(_INTL("{1} launched an aerial bombardment!", user.pbThis))
  end
 
  def pbShowAnimation(id, user, targets, hitNum = 0, showAnimation = true)
    hitNum = 1 if !@battle.futureSight   # Charging anim
    super
  end

end

This is after a lot of trial and error to get this far! Right now, the move does work as intended when used, and the enemy gets affected by it, but instead of taking the damage, the enemy says '{pkmn} lauched an aerial bombardment!'... So I've somehow made it so that the intended target is instead using the move. Any help here would be appreciated! Thanks!
 
Back
Top