Pokemon Class library

Dependents:   2645_Game_Project_2

Revision:
2:bbd4389980c3
Parent:
1:7b0bc092dbe5
Child:
3:100f558098c0
--- a/Pokemon.cpp	Thu Apr 20 15:34:33 2017 +0000
+++ b/Pokemon.cpp	Mon Apr 24 20:50:48 2017 +0000
@@ -2,7 +2,8 @@
 #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"};
 
@@ -75,8 +76,29 @@
     return levels;
 }
 
-int Pokemon::attck(Pokemon e)
+int Pokemon::OpponentTurn(Pokemon e)
 {
-
+    int HP1 = healthPoints;
+    int damage1 = e.level;
+    if ((e.typing == Fire && typing == Water )|| (e.typing == Grass && typing == Fire) || (e.typing == Water && typing == Grass)) {//half damage
+        damage1 = 0.5 * damage1;
+    } else if ((e.typing == Fire && typing == Grass)||(e.typing == Grass && typing == Water)||(e.typing == Water && typing == Fire)) {//double damage
+        damage1 = 2 * damage1;
+    } 
+    HP1 = HP1 - damage1;
+    return HP1;
 }
 
+
+int Pokemon::YourTurn(Pokemon e)
+{
+    int HP2 = e.healthPoints;
+    int damage2 = level;
+    if ((e.typing == Fire && typing == Water )|| (e.typing == Grass && typing == Fire) || (e.typing == Water && typing == Grass)) {//double damage
+        damage2 = 2 * damage2;
+    } else if ((e.typing == Fire && typing == Grass)||(e.typing == Grass && typing == Water)||(e.typing == Water && typing == Fire)) {//half damage
+        damage2 = 0.5 * damage2;
+    } 
+    HP2 = HP2 - damage2;
+    return HP2;
+}