• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Question] Pokemon Trainer AI review

Corvus of the Black Night

Wild Duck Pokémon
3,416
Posts
15
Years
Hello folks! I'm currently working on designing the Enemy Trainer AI for Braillemon, which is a pokemon port that I'm working on. I wanted to see if people would review my basic AI setup and see if there's some changes I should make.

Some notes about Braillemon:
Braillemon uses mixed generation setups. It has Gen I Pokemon, Gen II moves, Gen III stats (with EVs and all that) and Gen IV's physical/special split.

Braillemon's AI is going to be sorted by tiers. Basically, the better the tier, the better the AI is. Here's the basic lineup I have now. I was wondering if you guys could throw over some suggestions and review it. Since I'm programming it from scratch, there's no need to comply to some information with Pokemon Essentials or whatever else is used these days. Just throw your suggestions out there and I'll see what I can do.

Code:
[B]AI tiers:[/B]

All tiers can use items.

[B]Tier 0:[/B]
Random moves only. Never switches.

[B]Tier 1:[/B]
Random, but if a stalemate between two attacking moves, will choose the attacking move that is more powerful. Will not inflict status effects if already suffering from status effects. Never switches.

Will not use substitute or belly drum if HP is too low.

[B]Tier 2:[/B]
If Pokemon has higher defenses than offenses, begins with first a status inflicting move, then a status lowering move. Once both have been implemented, will attack normally.

If Pokemon has higher offenses, will skip status lowering abilities unless enemy defenses/offenses are unusually high, using the status inflicting move to lower the stat. Will use a move that inflicts paralysis to lower speed, or a speed dropping move, but will not use status effecter if misses more than twice.

Both examples will use foresight or Odor sleuth if player has used Double Team or Minimize more than twice. If they lack this move, will use a 100% accuracy move instead.

Will use recovery moves if 33% or less.

Will not use substitute or belly drum if HP is too low.

Will only switch to counter Perish Song, and only on the last turn.

[B]Tier 3:[/B]
If Pokemon has higher defenses than offenses, begins with first a status inflicting move, then a status lowering move. Once both have been implemented, will attack normally.

If Pokemon has higher offenses, will skip status lowering abilities unless enemy defenses/offenses are unusually high, using the status inflicting move to lower the stat. Will use a move that inflicts paralysis to lower speed, or a speed dropping move, but will not use status effecter if misses more than twice.

Both examples will use foresight or Odor sleuth if player has used Double Team or Minimize more than twice. If they lack this move, will use a 100% accuracy move instead.

Will use recovery moves if 50% or less.

Will switch if no moves are super effective and another character in the party has a super effective offensive move, or if the trainer has no moves that will hit the enemy Pokemon (for example, if a pokemon has all normal type moves, and sing, and is facing gastly, then will switch if gastly is under a status effect). Will also switch if affected by perish song. Will not use baton pass if affected by perish song.

[B]Tier 4:[/B]
Highest tier.


Will have the following strategies implemented, checking for moveset.

Baton Pass + Status Booster
Will boost a stat up two stages then attempt to Baton Pass.

Baton Pass + Substitute
Will set up a substitute, then attempt to Baton Pass.

Mean Look/Spider Web + Perish Song
Will use the trapping move, then perish song away.

Super Fang + Quick Attack
Will use Super Fang to half HP, then use quick attack.

Spikes + Whirlwind/Roar
Will use spikes to set up, then whirlwind or roar to cause damage onto opponents. If a status effect move is in the moveslots, such as Toxic, will try to inflict a status effect before whirlwinding again (unless already has a status effect).

Endure + Reversal/Flail
Will use endure, then use reversal for a strong final attack.

Substitute + Leech Seed
Will use substitute, then Leech Seed.

Substitute + Pain Split
Will use Substitute, then pain split (if effective).

Reflect + Light Screen
Will use both moves first, then attack. Once one goes down, will put it back up.

Broad move combinations:

If has a paralysis and flinching move, will inflict paralysis, then try to flinch.

If has a paralysis and confusing move, will inflict paralysis, then try to confuse. After confusing, will attack.


Will focus on using attacks that are the same kind (physical or special as the attacking stat of the user. If Super Effective or STAB causes more damage, then will use that move.

If User uses an attacking move twice in a row, will use counter/mirror coat depending on that move.

Will use whirlwind/Roar if user is using stat booster to set up.

Will use Heal Bell if any Pokemon has a status effect, but will not use the move every turn.

Will use recovery move if HP is below 50%, but will not use a recovery move three times in a row.

FROM THERE

If Pokemon has higher defenses than offenses, begins with first a status inflicting move, then a status lowering move. Once both have been implemented, will attack normally.

If Pokemon has higher offenses, will skip status lowering abilities unless enemy defenses/offenses are unusually high, using the status inflicting move to lower the stat. Will use a move that inflicts paralysis to lower speed, or a speed dropping move, but will not use status effecter if misses more than twice.

Both examples will use foresight or Odor sleuth if player has used Double Team or Minimize more than twice. If they lack this move, will use a 100% accuracy move instead.

Will switch if no moves are super effective and another character in the party has a super effective offensive move, or if the trainer has no moves that will hit the enemy Pokemon (for example, if a pokemon has all normal type moves, and sing, and is facing gastly, then will switch if gastly is under a status effect). Will also switch if affected by perish song. Will not use baton pass if affected by perish song. Will switch out if trainer has a strong defensive pokemon with at least a 0.5x damage multiplier from the current move, if Pokemon is below 33% HP. Will switch out if an initially fast pokemon has paralysis, or an initially physically strong pokemon has a burn. Will automatically switch out if Pokemon is frozen. If Pokemon does not have Snore or Sleep Talk, will switch out if Asleep. Will switch out from Toxic Poison after three turns or if HP is below 33%.
 

UnderMybrella

Wandering Programmer
280
Posts
13
Years
I skimmed it a little, but it looks promising. One thing though - Improve tier 0 and 1. Random moves like that would only be good for, pretty much, the first route or two, in which case, abolish tier 0 and just have tier 1.
 
180
Posts
12
Years
  • Age 36
  • Seen Aug 12, 2023
You should specify which tiers will also take type advantages into account as well. Maybe on like Tier 2 it'd be a (just throwing numbers out there) 75% chance it'd use a super effective move against the opponent pokemon. In Tier 3 maybe the AI trainer will switch out a pokemon if it's weak against a certain pokemon type, and in Tier 4, that carries over with the addition of "remembering" if a pokemon used a certain pokemon that has an attack not matching its type.

e.g - AI trainer sends out Steelix, you send out Salamence. Salamence uses Earthquake. the AI now knows that your Salamence has a ground type move, so it won't send out a pokemon versus Salamence that's weak against ground types.
 

Corvus of the Black Night

Wild Duck Pokémon
3,416
Posts
15
Years
Most trainers are tier 1 right now. Tier 1 performs a list of checks. Tier 0 is used mainly for wild pokemon, but can be used for the first few trainers you encounter.

Basically, it randomly chooses a move, then it checks if that move is a status inflicting move, a special effect move (such as protect for example), and checks if those moves will get a "had no effect" message. If they do, it chooses another move. If the randomly chosen move is an attacking move, it chooses the strongest alternative. For example, if an arbok knows earthquake and poison sting (lol), and the enemy is a grass type, it will still use Earthquake because it will do more damage regardless.

Otherwise there are no checks. Higher tiers will be used with gym leaders and elite 4 and special trainers. These will implement, in tier 2, certain strategic choices during certain circumstances. At tier 3 I'll start implementing user input response with minimax implementation.
 
Back
Top