Advertiser Content

Scripting Question Mega Evolution Speed

Started by Juno and Ice April 6th, 2019 3:30 PM
  • 179 views
  • 5 replies

juliorain

Male
USA
Seen 40 Minutes Ago
Posted 40 Minutes Ago
1,485 posts
2.8 Years
essentials is programed to gen 6 so that makes sense that youre curious about this.

lessee.... you'll want to see the method def pbMegaEvolve

  def pbMegaEvolve(index)
    return if !@battlers[index] || !@battlers[index].pokemon
    return if !(@battlers[index].hasMega? rescue false)
    return if (@battlers[index].isMega? rescue true)
    ownername=pbGetOwner(index).fullname
    ownername=pbGetOwner(index).name if pbBelongsToPlayer?(index)
    case (@battlers[index].pokemon.megaMessage rescue 0)
    when 1 # Rayquaza
      pbDisplay(_INTL("{1}'s fervent wish has reached {2}!",ownername,@battlers[index].pbThis))
    else
      pbDisplay(_INTL("{1}'s {2} is reacting to {3}'s {4}!",
         @battlers[index].pbThis,PBItems.getName(@battlers[index].item),
         ownername,pbGetMegaRingName(index)))
    end
    pbCommonAnimation("MegaEvolution",@battlers[index],nil)
    @battlers[index].pokemon.makeMega
    @battlers[index].form=@battlers[index].pokemon.form
    @battlers[index].pbUpdate(true)
    @scene.pbChangePokemon(@battlers[index],@battlers[index].pokemon)
    pbCommonAnimation("MegaEvolution2",@battlers[index],nil)
    meganame=(@battlers[index].pokemon.megaName rescue nil)
    if !meganame || meganame==""
      meganame=_INTL("Mega {1}",PBSpecies.getName(@battlers[index].pokemon.species))
    end
    pbDisplay(_INTL("{1} has Mega Evolved into {2}!",@battlers[index].pbThis,meganame))
    PBDebug.log("[Mega Evolution] #{@battlers[index].pbThis} became #{meganame}")
    side=(pbIsOpposing?(index)) ? 1 : 0
    owner=pbGetOwnerIndex(index)
    @megaEvolution[side][owner]=-2
  end
hmmmm good question but my guess is to start there

WolfPP

Discord: Wolf#1235

Male
Brazil
Online now
Posted 1 Hour Ago
468 posts
277 Days
Generation VII

In Generation VII, a Pokémon's Speed after Mega Evolution is used to determine turn order, not its Speed before. Likewise, if a Pokémon only has an Ability such as Prankster before Mega Evolution, appropriate moves will not gain priority. If a Pokémon gains Prankster upon Mega Evolution, appropriate moves will gain priority.

Rayquaza cannot Mega Evolve if it holds a Z-Crystal.

In Pokémon: Let's Go, Pikachu! and Let's Go, Eevee!, as the Held item mechanic is not implemented, the player simply needs to have the compatible Mega Stone in their bag to access a Pokémon's Mega Evolution. The player can also manually pick which form Charizard or Mewtwo can become from the move menu.
I will find a way too.

Maybe here:
Spoiler:

################################################################################
# Attack phase.
################################################################################
  def pbAttackPhase
    @scene.pbBeginAttackPhase
    for i in 0...4
      @successStates[i].clear
      if @choices[i][0]!=1 && @choices[i][0]!=2
        @battlers[i].effects[PBEffects::DestinyBond]=false
        @battlers[i].effects[PBEffects::Grudge]=false
      end
      @battlers[i].turncount+=1 if !@battlers[i].fainted?
      @battlers[i].effects[PBEffects::Rage]=false if !pbChoseMove?(i,:RAGE)
    end
    # Prepare for Z Moves
    for i in 0..3
      next if @choices[i][0]!=1
      side=(pbIsOpposing?(i)) ? 1 : 0
      owner=pbGetOwnerIndex(i)
      if @zMove[side][owner]==i
        @choices[i][2].zmove=true
      end
    end 
    # Calculate priority at this time
    @usepriority=false
    priority=pbPriority(false,true)
    # Mega Evolution
    megaevolved=[]
    for i in priority
      if @choices[i.index][0]==1 && !i.effects[PBEffects::SkipTurn]
        side=(pbIsOpposing?(i.index)) ? 1 : 0
        owner=pbGetOwnerIndex(i.index)
        if @megaEvolution[side][owner]==i.index
          pbMegaEvolve(i.index)
          megaevolved.push(i.index)
        end
      end
    end
    if megaevolved.length>0
      for i in priority
        i.pbAbilitiesOnSwitchIn(true) if megaevolved.include?(i.index)
      end
    end

Juno and Ice

Developer of Pokémon Floral Tempus

Non-binary
Seen 13 Hours Ago
Posted 4 Days Ago
77 posts
1 Years
After it mega evolves or after? Your question is kind of ambiguous there.
Currently if a Beedrill mega evolves it will get outsped by everything because in Gen 6, mega evolution calculated turn order before mega evolution. In Gen 7 this was changed so that the turn order is counted after mega evolution, so Mega Beedrill will outspeed everything it's supposed to on the first turn of mega
evolution.

Vendily

Female
Seen 10 Hours Ago
Posted 1 Day Ago
868 posts
3.8 Years
My guess for what needs to change is here, in def pbAttackPhase.
    # Calculate priority at this time
    @usepriority=false
    priority=pbPriority(false,true)
    # Mega Evolution
    megaevolved=[]
    for i in priority
      if @choices[i.index][0]==1 && !i.effects[PBEffects::SkipTurn]
        side=(pbIsOpposing?(i.index)) ? 1 : 0
        owner=pbGetOwnerIndex(i.index)
        if @megaEvolution[side][owner]==i.index
          pbMegaEvolve(i.index)
          megaevolved.push(i.index)
        end
      end
    end
    if megaevolved.length>0
      for i in priority
        i.pbAbilitiesOnSwitchIn(true) if megaevolved.include?(i.index)
      end
    end
    # Call at Pokémon
    for i in priority
      if @choices[i.index][0]==4 && !i.effects[PBEffects::SkipTurn]
        pbCall(i.index)
      end
    end
you'll want to recalulate priority, so these two lines will have to show up again after the mega evolution stuff.
    @usepriority=false
    priority=pbPriority(false,true)

Advertiser Content