Example #1
0
void Play2(Pokemon& Tail,Pokemon& Volt, Graphics test1, int posMo2, int& CurrHP1, int& CurrHP2){
	int HP1 = Tail.HP(), HP2 = Volt.HP();

	setStage(test1, HP1, CurrHP1, HP2, CurrHP2);
	if (Volt.useMove(posMo2) == 0){
		mvprintw(31,61,"Miss Hit");
	}else if (Volt.useMove(posMo2) > 0){
		setStage(test1, HP1, CurrHP1, HP2, CurrHP2);
		if (Tail.effectiveness(Volt.ATKDMGT(posMo2)) == 1){
			Tail.defend(Volt, posMo2);
			CurrHP1 = Tail.GamHP1();
			mvprintw(31,61,"Super Effective!");
		}else if (Tail.effectiveness(Volt.ATKDMGT(posMo2)) == 2){
			Tail.defend(Volt, posMo2);
			CurrHP1 = Tail.GamHP1();
			mvprintw(31,61,"Not very Effective!");
		}else if (Tail.effectiveness(Volt.ATKDMGT(posMo2)) == 3){
			Tail.defend(Volt, posMo2);
			CurrHP1 = Tail.GamHP1();
			mvprintw(31,61,"Doesn't affect opponent");
		}else{
			mvprintw(31,61,"It Hit!");
			Tail.defend(Volt, posMo2);
			CurrHP1 = Tail.GamHP1();
		}
		setStage(test1, HP1, CurrHP1, HP2, CurrHP2);
		getch();
	}else{
		Tail.defend(Volt, posMo2);
		CurrHP1 = Tail.GamHP1();
		Tail.setState(Volt.useMove(posMo2));
		mvprintw(31,61,"Status Given");
	}
}
Example #2
0
char charValMov(Graphics test1,Pokemon& currentPok, int HP2, int& CurrHP2){
	char resp;
	int posMo;
	char posMoch[1];
	bool validarEntrada = true;
	getch();
	int HP1 = currentPok.HP(), otHP2 = HP2;
	int CurrHP1 = currentPok.HP(), otCurrHP2 = CurrHP2;
	setStage(test1, HP1, CurrHP1, HP2, CurrHP2);
	while(validarEntrada){
		setStage(test1, HP1, CurrHP1, HP2, CurrHP2);
		mvprintw(29,61,"Move: ");
		currentPok.drawMoves();
		noecho();
		char temp;
		temp = getch();
		posMoch[0] = temp;
		posMo = atoi(posMoch);
		if(charPos(temp, posMo, currentPok)){
			echo();
			resp = temp;
			attron(COLOR_PAIR(3));
			mvaddch(29,75,resp);
			validarEntrada = false;
		}else{
			setStage(test1, HP1, CurrHP1, HP2, CurrHP2);
			currentPok.drawMoves();
			validarEntrada == true;
			mvprintw(29,61,"Move: ");
			mvprintw(31,61,"Invalid Input!!!");	
		}
		getch();
		clear();
	}
	return resp;
}