Pokemon Class library

Dependents:   2645_Game_Project_2

Pokemon.cpp

Committer:
200923317
Date:
2017-04-20
Revision:
1:7b0bc092dbe5
Parent:
0:1fa2aa6d65e8
Child:
2:bbd4389980c3

File content as of revision 1:7b0bc092dbe5:

#include "Pokemon.h"
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Sprites.h"
std::string pokeNames[3] = {"Charmander","Bulbasaur","Squirtle"};
std::string TypeString[3] = {"Fire", "Grass", "Water"};

Pokemon::Pokemon(void)
{
    Pokemon(5,20,Fire);
}


Pokemon::Pokemon(uns lvl, uns HP, PokeType type)
{
    level = lvl;
    healthPoints = HP;
    typing = type;
    lvlUp = 20;
}


void Pokemon::setType(PokeType Type)
{
    typing = Type;
    healthPoints = 20;
    level = 5;

}

void Pokemon::XP()
{
    if (exp >= lvlUp) {
        Pokemon::levelUp();
        lvlUp = lvlUp + 15;
    }
}

void Pokemon::levelUp()
{
    level ++;
    healthPoints += 2;
    exp = 0;
}

std::string Pokemon::Name(void)
{

    char name[25];
    strncpy(name,pokeNames[typing].c_str(), sizeof(name));
    return name;
}

std::string Pokemon::Type(void)
{
    char typ[15];
    strncpy(typ,TypeString[typing].c_str(), sizeof(typ));
    char typeBuffer[30];
    sprintf(typeBuffer, "Type: %s", typ);
    return typeBuffer;
}

std::string Pokemon::HP(void)
{
    char stats[50];
    sprintf(stats, "HP: %u", healthPoints);
    return stats;
}

std::string Pokemon::Level(void)
{
    char levels[50];
    sprintf(levels, "Lvl:%u", level);
    return levels;
}

int Pokemon::attck(Pokemon e)
{

}