A long long time ago, the sky was dark and gloomy, the ocean was deep and mysterious, and the continent was covered by lava and sandstorm. The mad wild world was dominated by what’s called Pokémon today. It’s a prehistoric era, where the ancient monsters were both arrogant and noble. But it will only last until the human–or whatever is the so-called trainer–comes.
These beautiful creatures are now puppets of a bunch of goddamn ten years old kids. They travel across countries to collect different species of Pokémon for their fetishism, for they are addicted to control, to dominate lives that cannot defy them. Thousands of thousands of innocent Pokémons got caught, imprisoned, and traded as goods.
And yet it’s not the worst. Like any civilization did to the slaves, trainers love to have their Pokémon battle against other trainers’ Pokémon. They compete with each other in their Pokémon battles and consider it glorious if they win, although all they do is sit and watch the poor Pokémons bleeding, burning to death.
Now as a Pokémon battle field manager, you are asked to report the battle process between two given Pokémons. We’ll dig into the details in the following.
In this problem, you are asked to implement 2 functions:
The following is “function.h”. It is guaranteed that the given Pokémon would only be one of the following 5 types: "Geodude", "Raichu", "Golbat", "Magnemite", and "Exeggutor", indexed from 0 to 4.
For the function “level_up”, you are going to upgrade a Pokémon. Here are the details:
For the function “battle”, you are going to simulate a battle process. Here are the details:
#include <stdio.h>
#define lvup_atk 200
#define lvup_dfn 100
#define lvup_maxHp 20
#define lvup_maxMp 15
#define T 2
typedef struct pokemon{
int id;
char name[10];
int level;
int attack;
int defense;
int Hp;
int Mp;
int maxHp;
int maxMp;
int costMp;
}Pokemon;
// TODO: upgrade and recover the Pokémon
void level_up(Pokemon *P);
// TODO: simulate and print the process of the battle
void battle(Pokemon *A, Pokemon *B);
The first line contains an integer n, representing the number of Pokémons.
The second line contains n integers xi, representing the type of each Pokémon.
The third line contains an integer t, representing the number of operations.
Then, t lines follow, each representing an operation.
Each operation is in the following forms:
1 id:
The id th Pokémon level up.
2 a b:
Please print the battle process of the a th Pokémon and the b th Pokémon.
Execute each operation described in the statement above.
Check the sample output for more details.