Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef PKMN_H
- #define PKMN_H
- #include <iostream>
- #include <iomanip>
- #include <string>
- #include <cmath>
- enum TYPING {NIL, NORMAL, FIGHT, FLYING, POISON, GROUND, ROCK, BUG, GHOST, STEEL, FIRE, WATER, GRASS, ELECTR, PSYCHC, ICE, DRAGON, DARK, FAIRY};
- //-STAT ATT DEF Speed SPA SPDef
- enum NATURE {HAR, LON, BRV, ADA, NAU, //+STAT Attack
- BOL, DOC, REL, IMP, LAX, // Defense
- TIM, HAS, SER, JOL, NAI, // Speed
- MOD, MIL, QUI, BSH, RSH, // Special Attack
- CLM, GEN, SAS, CAR, QUR}; // Special Defense
- /* These values stand for:
- Hardy, Lonely, Brave, Adamant, Naughty
- Bold, Docile, Relaxed, Impish, Lax
- Timid, Hasty, Serious, Jolly, Naive
- Modest, Mild, Quiet, Bashful, Rash
- Calm, Gentle, Sassy, Careful, Quirky*/
- double getEffectiveness (TYPING, TYPING);
- class pkmn
- {
- string myName;
- string myurl;
- int maxHP;
- int curHP;
- int curEn;
- int att;
- int def;
- int spa;
- int spd;
- int spe;
- NATURE nat;
- public:
- void printData(void);
- pkmn(void);
- };
- pkmn::pkmn()
- {
- myName="Bulbasaur";
- myurl="http:////veekun.com//dex//media//pokemon//main-sprites//black-white//1.png";
- maxHP=80;
- curHP=maxHP;
- curEn=100;
- att=0;
- def=0;
- spa=0;
- spd=0;
- spe=0;
- }
- void pkmn::printData()
- {
- //cout << "printing data for " << myName << ".\n";
- //cout << "[url=" << myUrl << "]" << myName << "[/url]\n";
- //cout << myName << endl;
- cout << "HP: " << curHP << "/" << maxHP << endl;
- cout << "EN: " << curEn << "/100\n";
- }
- double getTypeEffectiveness(TYPING attack, TYPING defend)
- {
- double gTEvar = 0;
- int effective[18][18] = {
- {0, 0, 0, 0, 0,-1, 0, 7,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //normal
- {1, 0,-1,-1, 0, 1,-1, 7, 1, 0, 0, 0, 0,-1, 0, 0, 0, 0}, //fight
- {0, 1, 0, 0, 0,-1, 1, 0,-1, 0, 0, 1,-1, 0, 0, 0, 0, 0}, //flying
- {0, 0, 0,-1,-1,-1, 0,-1, 7, 0, 0, 1, 0, 0, 0, 0, 0, 1}, //poison
- {0, 0, 7, 1, 0, 1,-1, 0, 1, 1, 0,-1, 1, 0, 0, 0, 0, 0}, //ground
- {0,-1, 1, 0,-1, 0, 1, 0,-1, 1, 0, 0, 0, 0, 1, 0, 0, 0}, //rock
- {0,-1,-1,-1, 0, 0, 0,-1,-1,-1, 0, 1, 0, 1, 0, 0, 1,-1}, //bug
- {7, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0,-1, 1}, //ghost
- {0, 0, 0, 0, 0, 1, 0, 0,-1,-1,-1, 0,-1, 0, 1, 0, 0, 1}, //steel
- {0, 0, 0, 0, 0,-1, 1, 0, 1,-1,-1, 1, 0, 0, 1,-1, 0, 0}, //fire
- {0, 0, 0, 0, 1, 1, 0, 0, 0, 1,-1,-1, 0, 0, 0,-1, 0, 0}, //water
- {0, 0,-1,-1, 1, 1,-1, 0,-1,-1, 1,-1, 0, 0, 0,-1, 0, 0}, //grass
- {0, 0, 1, 0, 7, 0, 0, 0, 0, 0, 1,-1,-1, 0, 0,-1, 0, 0}, //electric
- {0, 1, 0, 1, 0, 0, 0, 0,-1, 0, 0, 0, 0,-1, 0, 0, 7, 0}, //psychic
- {0, 0, 1, 0, 1, 0, 0, 0,-1,-1,-1, 1, 0, 0,-1, 1, 0, 0}, //ice
- {0, 0, 0, 0, 0, 0, 0, 0,-1, 0, 0, 0, 0, 0, 0, 1, 0, 7}, //dragon
- {0,-1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0,-1,-1}, //dark
- {0, 1, 0,-1, 0, 0, 0, 0,-1,-1, 0, 0, 0, 0, 0, 1, 1, 0}};//fairy
- // n f f p g r b g s f w g e p i d d f
- // o i l o r o u h t i a r l s c r a a
- // r g y i o c g o e r t a e y e a r i
- // m h s u k s e e e s c c g k r
- // a t o n t l r s t h o y
- // l n d r c n
- if (attack==NIL||defend==NIL)
- return 0;
- else
- gTEvar = effective[static_cast<TYPING>(attack-1)][static_cast<TYPING>(defend-1)];
- if (gTEvar==7)
- return 0;
- else
- return pow(1.5, gTEvar);
- }
- #endif
- ---------
- //error message
- 1>------ Build started: Project: Pokemon API 2010, Configuration: Debug Win32 ------
- 1> Driver.cpp
- 1>e:\programs\damage calculator\damage calculator\pokemon.h(23): error C2146: syntax error : missing ';' before identifier 'myName'
- 1>e:\programs\damage calculator\damage calculator\pokemon.h(23): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
- 1>e:\programs\damage calculator\damage calculator\pokemon.h(23): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
- 1>e:\programs\damage calculator\damage calculator\pokemon.h(24): error C2146: syntax error : missing ';' before identifier 'myurl'
- 1>e:\programs\damage calculator\damage calculator\pokemon.h(24): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
- 1>e:\programs\damage calculator\damage calculator\pokemon.h(24): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
- 1>e:\programs\damage calculator\damage calculator\pokemon.h(40): error C2065: 'myName' : undeclared identifier
- 1>e:\programs\damage calculator\damage calculator\pokemon.h(41): error C2065: 'myurl' : undeclared identifier
- 1>e:\programs\damage calculator\damage calculator\pokemon.h(51): error C2653: 'pkmn' : is not a class or namespace name
- 1>e:\programs\damage calculator\damage calculator\pokemon.h(56): error C2065: 'cout' : undeclared identifier
- 1>e:\programs\damage calculator\damage calculator\pokemon.h(56): error C2065: 'curHP' : undeclared identifier
- 1>e:\programs\damage calculator\damage calculator\pokemon.h(56): error C2065: 'maxHP' : undeclared identifier
- 1>e:\programs\damage calculator\damage calculator\pokemon.h(56): error C2065: 'endl' : undeclared identifier
- 1>e:\programs\damage calculator\damage calculator\pokemon.h(57): error C2065: 'cout' : undeclared identifier
- 1>e:\programs\damage calculator\damage calculator\pokemon.h(57): error C2065: 'curEn' : undeclared identifier
- ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement