Ok, I've trimmed you a function from my own implementation of this that I completed (which is pretty safe for the most part).
For the first part, what you want to do is add the following at the very end of the conditional in
PokeBattle_Battle which initializes wild battlers in single battle:
Anywhere in the class
PokeBattle_Scene, define the following function:
Code:
def raiseSpeciesStats
# cancels if opposing trainer or double wild battle
return if @battle.opponent || @battle.party2.length > 1
# put some method of fetching stat raises here
stats = $game_variabes[X]
# cancels if no stat raise queued
return if stats.nil? || !stats.is_a?(Array) || stats.length < 2
battler = @battle.battlers[1]; s = nil; succeed = false; avg = 0
# iterates through each stat raise
for i in 0...stats.length
next if i%2 == 1
stat = getConst(PBStats, stats[i])
# failsafe to check whether stat raise can be applied
next if stat.nil? || (!stats[i+1] && !stats[i+1].is_a?(Numeric))
# gets proper id and value for stat raise
s = PBStats.getName(stat) if stats.length <= 2
inc = stats[i+1]; avg += inc
# applies stat raise
battler.pbIncreaseStatBasic(stat, inc, nil, false, true)
succeed = true
end
# failsafe for stat raise
return if !succeed
# add a call to play your common animation here
# pbCommonAnimation(anim)
# additional formatting for text (to display per stages)
rsm = [_INTL("increased"),_INTL("rose sharply"),_INTL("increased drastically")]
j = (2*avg)/stats.length - 1; j = 0 if j < 0; j = 2 if j > 2
# displays message of stat(s) raised
pbDisplayPausedMessage(_INTL("{1}'s Aura flared to life!\nIts {2} {3}!", battler.pokemon.name, (s.nil? ? "stats" : s), rsm[j]))
# don't forget to reset your variable
$game_variabes[X] = nil
end
Actually triggering the code to get the stat raise in battle would be very simple. You'd just have to add the appropriate stat names, and the factor you're increasing them by, to the defined variable in the code before you trigger the wild battle from your event like this:
Code:
$game_variables[X] = [:ATTACK, 2, :SPEED, 2]
Where the entries come in pairs: first the symbolic stat name, then the factor, then the symbolic stat name, then the factor, and so on for however many stats you want to raise ...
You need to specify at least 1 symbolic status name and 1 numeric factor by which you're raising it.
Please go through the code first, I've left some comments on some additional stuff you'd have to configure for extra flare. And don't forget to replace the
X in the
$game_variabes[X] instances to an actual variable ID. This is as plug and play as it gets.