Skip to content

StevensSEC/pokemonbattlelib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pokemon Battle Library

A portable library for accurately simulating pokemon battles.

CI Test codecov

Usage

Documentation

Basic Example Battle

p1 := GeneratePokemon(PkmnPikachu,
	WithLevel(20),
	WithMoves(MoveThunderShock))
p2 := GeneratePokemon(PkmnBulbasaur,
	WithLevel(20),
	WithMoves(MoveTackle))
a1 := Agent(new(dumbAgent))
b := New1v1Battle(p1, &a1, p2, &a1)
b.Start()
transactions, _ := b.SimulateRound()
for _, t := range transactions {
	switch tt := t.(type) {
	case UseMoveTransaction:
		fmt.Printf("%s used %s on %s\n", b.GetPokemon(tt.User), tt.Move, b.GetPokemon(tt.Target))
	case DamageTransaction:
		fmt.Printf("%s took %d damage\n", b.GetPokemon(tt.Target), tt.Damage)
	case HealTransaction:
		fmt.Printf("%s healed for %d HP\n", b.GetPokemon(tt.Target), tt.Amount)
	case FaintTransaction:
		fmt.Printf("%s fainted\n", b.GetPokemon(tt.Target))
	case PPTransaction:
		continue
	default:
		fmt.Printf("Transaction: %T - %v\n", t, t)
	}
}

Contributing

  1. Make sure that you at least have Go 1.15
  2. Clone this repo
git clone [email protected]:StevensSEC/pokemonbattlelib.git
  1. Make and commit your changes.
  2. Create a Pull Request with your changes.

Using the github cli:

gh pr create

About

A portable library for accurately simulating Pokemon battles.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages