Skip to content

Conversation

NikolaJelic
Copy link
Contributor

This PR is referencing issue #1.

The Pokemon loads it's next_move which is selected by the player from a list of possible options. The move selection and the possible moves, fetched from the Pokemon API will be implemented by @hentai-chan .
The attack damage is calculated using the formula found here

Testing and usage

	Move stab = Move("stab", MoveTypes::ATTACK, 80, 30);
	Move heal = Move("heal", MoveTypes::HEAL, 100, 50);

	Pokemon bulbasaur = Pokemon("Bulbasaur", 10, 50, 30, stab);
	Pokemon pikatchu = Pokemon("Pikatchu", 3, 50, 30, heal);
	
	std::cout << "Pikatchu hp:" << pikatchu.m_hp << std::endl;	
	std::cout << " Bulbasaur used: " << bulbasaur.make_move(bulbasaur, pikatchu).m_move_name << std::endl;
	std::cout << "Pikatchu hp after 1. attack:" << pikatchu.m_hp << std::endl;
	pikatchu.make_move(pikatchu, pikatchu);
	std::cout << "Pikatchu hp after heal:" << pikatchu.m_hp << std::endl;

A move can only be made if the Pokemon isAlive = true

@NikolaJelic NikolaJelic added the enhancement New feature or request label Mar 18, 2021
@NikolaJelic NikolaJelic self-assigned this Mar 18, 2021
auto name = get_user_input<std::string>("What's your name? ");
std::cout << "Hello, " << name << '!' << '\n';
std::cin.get();
/* auto name = get_user_input<std::string>("What's your name? ");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the program just returns 0?


struct Pokemon
{
std::string m_name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This struct is too huge and flat, use sub structs to improve it

{
attack *= 2; // crit damage
}
int damage = ((((((2 * source.m_level / 5 + 2) * attack * source.m_next_move.m_power) / target.m_def) / 50) + 2) * random_range<int>(217, 255)) / 255;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link this URL for future reference: https://www.math.miami.edu/~jam/azure/compendium/battdam.htm, could be hard to find later (in a comment above this line)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is linked at the start of that function

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better put the comment directly above the line where this formula is used, makes for a better reading flow but that's just nitpicking :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@hentai-chan hentai-chan merged commit fad8b0f into integration Mar 18, 2021
@hentai-chan hentai-chan deleted the pokemon branch March 18, 2021 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants