#===============================================================================
# * adding and defining variables for the class PokeBattle_Trainer
#===============================================================================
class PokeBattle_Trainer
attr_accessor :times_linked
attr_accessor :link_battles
attr_accessor :link_wins
attr_accessor :link_trades
attr_accessor :wild_pokemon_encountered
attr_accessor :trainers_battled
attr_accessor :nature
attr_accessor :badgeObtainTime
def nature
@nature=$Trainer.publicID($Trainer.id)%25 if !@nature
return PBNatures.getName(@nature)
end
def times_linked
@times_linked=0 if !@times_linked
return @times_linked
end
def link_battles
@link_battles=0 if !@link_battles
return @link_battles
end
def link_wins
@link_wins=0 if !@link_wins
return @link_wins
end
def link_trades
@link_trades=0 if !@link_trades
return @link_trades
end
def wild_pokemon_encountered
@wild_pokemon_encountered=0 if !@wild_pokemon_encountered
return @wild_pokemon_encountered
end
def trainers_battled
@trainers_battled=0 if !@trainers_battled
return @trainers_battled
end
def badgeObtainTime
if !@badgeObtainTime
@badgeObtainTime=[]
default_time="0/0/2000"
for i in 0...8
@badgeObtainTime=default_time
end
end
return @badgeObtainTime
end
end
def obtainedBadge(badge)
$Trainer.badges[badge]=true
$Trainer.badgeObtainTime[badge]="#{pbGetTimeNow.mon}/#{pbGetTimeNow.day}/#{pbGetTimeNow.year}"
end
# increasing $Global.wild_pokemon_encountered by one when having a wild battle.
alias olddd_pbWildBattle :pbWildBattle
def pbWildBattle(species,level,variable=nil,canescape=true,canlose=false)
$Trainer.wild_pokemon_encountered+=1 if $Trainer.pokemonCount != 0
olddd_pbWildBattle(species,level,variable=nil,canescape=true,canlose=false)
end
# increasing $Global.wild_pokemon_encountered by two when having a wild double battle.
alias olddd_pbDoubleWildBattle :pbDoubleWildBattle
def pbDoubleWildBattle(species1,level1,species2,level2,variable=nil,canescape=true,canlose=false)
$Trainer.wild_pokemon_encountered+=2 if $Trainer.pokemonCount != 0
olddd_pbDoubleWildBattle(species1,level1,species2,level2,variable=nil,canescape=true,canlose=false)
end
# increasing $Global.trainers_battled by one when having a battle.
alias olddd_pbTrainerBattle :pbTrainerBattle
def pbTrainerBattle(trainerid,trainername,endspeech,doublebattle=false,trainerparty=0,canlose=false,variable=nil)
$Trainer.trainers_battled+=1 if $Trainer.pokemonCount != 0
olddd_pbTrainerBattle(trainerid,trainername,endspeech,doublebattle=false,trainerparty=0,canlose=false,variable=nil)
end
# increasing $Global.trainers_battled by two when having a double battle.
alias olddd_pbDoubleTrainerBattle :pbDoubleTrainerBattle
def pbDoubleTrainerBattle(trainerid1, trainername1, trainerparty1, endspeech1,trainerid2, trainername2, trainerparty2, endspeech2, canlose=false,variable=nil)
$Trainer.trainers_battled+=2 if $Trainer.pokemonCount != 0
olddd_pbDoubleTrainerBattle(trainerid1, trainername1, trainerparty1, endspeech1,trainerid2, trainername2, trainerparty2, endspeech2, canlose=false,variable=nil)
end