- 1,224
- Posts
- 10
- Years
- Omnipresence
- Seen Aug 8, 2023
Here's some things. Let me know if there's any problems or suggestions. Red parts are what to change/add
Immunity: PokemonField
Cute Charm, Hustle, Pressure, Vital Spirit, Synchronize: Also in PokemonField
Immunity: PokemonField
Spoiler:
Code:
# Poison event on each step taken
Events.onStepTakenTransferPossible+=proc {|sender,e|
handled=e[0]
next if handled[0]
if $PokemonGlobal.stepcount % 4 == 0 && POISONINFIELD
flashed=false
for i in $Trainer.party
if i.status==PBStatuses::POISON && i.hp>0 && !i.egg? &&
!isConst?(i.ability,PBAbilities,:POISONHEAL) [COLOR="Red"]&& !isConst?(i.ability,PBAbilities,:IMMUNITY)[/COLOR]
if !flashed
$game_screen.start_flash(Color.new(255,0,0,128), 4)
flashed=true
end
if i.hp==1 && !POISONFAINTINFIELD
i.status=0
Kernel.pbMessage(_INTL("{1} survived the poisoning.\\nThe poison faded away!\\1",i.name))
next
end
i.hp-=1
if i.hp==1 && !POISONFAINTINFIELD
i.status=0
Kernel.pbMessage(_INTL("{1} survived the poisoning.\\nThe poison faded away!\\1",i.name))
end
if i.hp==0
i.changeHappiness("faint")
i.status=0
Kernel.pbMessage(_INTL("{1} fainted...\\1",i.name))
end
handled[0]=true if pbAllFainted
pbCheckAllFainted()
end
end
end
}
Cute Charm, Hustle, Pressure, Vital Spirit, Synchronize: Also in PokemonField
Spoiler:
Code:
def pbGenerateWildPokemon(species,level)
genwildpoke=PokeBattle_Pokemon.new(species,level,$Trainer)
items=genwildpoke.wildHoldItems
chances=[50,5,1]
chances=[60,20,5] if !$Trainer.party[0].egg? &&
isConst?($Trainer.party[0].ability,PBAbilities,:COMPOUNDEYES)
itemrnd=rand(100)
if itemrnd<chances[0] || (items[0]==items[1] && items[1]==items[2])
genwildpoke.item=items[0]
elsif itemrnd<(chances[0]+chances[1])
genwildpoke.item=items[1]
elsif itemrnd<(chances[0]+chances[1]+chances[2])
genwildpoke.item=items[2]
end
if getConst(PBItems,:SHINYCHARM) && $PokemonBag.pbQuantity(PBItems::SHINYCHARM)>0
for i in 0...2 # 3 times as likely
genwildpoke.personalID=rand(65536)|(rand(65536)<<16) if !genwildpoke.isShiny?
end
end
if rand(65536)<POKERUSCHANCE
genwildpoke.givePokerus
end
[COLOR="red"]#Cute Charm. Should also include swarming pokemon, if you implement that
if !$Trainer.party[0].egg? && isConst?($Trainer.party[0].ability,PBAbilities,:CUTECHARM)
if genwildpoke.gender !=2 && rand(100)<67 #&& $game_map.map_id !=XX where XX is the id of Hidden Grotto map, if you have one
genwildpoke.gender=($Trainer.party[0].gender==0)? 1:0
end
end
#Hustle, Pressure, Vital Spirit. Probably not the best way to implement this
if !$Trainer.party[0].egg? && (isConst?($Trainer.party[0].ability,PBAbilities,:HUSTLE) || isConst?($Trainer.party[0].ability,PBAbilities,:PRESSURE) || isConst?($Trainer.party[0].ability,PBAbilities,:VITALSPIRIT))
if rand(100)<50
extraincrease=(genwildpoke.level/10).floor
increase=(genwildpoke.level<=MAXIMUMLEVEL-extraincrease)? extraincrease:(genwildpoke.level<=MAXIMUMLEVEL-2)? 2:0
genwildpoke.level+=increase
end
end
#Synchronize
if !$Trainer.party[0].egg? && isConst?($Trainer.party[0].ability,PBAbilities,:SYNCHRONIZE)
genwildpoke.nature=$Trainer.party[0].nature if rand(100)<50
end[/COLOR]
Events.onWildPokemonCreate.trigger(nil,genwildpoke)
return genwildpoke
end
Last edited: