Пример #1
0
int main(void){
    DDRD |= (1<<THROW) | (1<<BUMP0) | (1<<BUMP1);         //Initializing outputs
    DDRD |= (1<<ENABLE) | (1<<STEP) | (1<<DIRECT);
    DDRD &= ~(1<<PD1) | ~(1<<PD0);                        //Initialize inputs
    
    PORTD |= (1<<THROW);		//Solenoid needs to be down
    
    DDRC |= (1<<PC3);        //Setting up an output so i can choose the plays
    DDRC &= ~(1<<PC1) | ~(1<<PC2) | ~(1<<PC0);		//Define input pins for plays and offence/defence 
	
    PORTC |= (1<<PC3);        //Always output a 1
	
	//#define Play1 (PINC & (1 << PC1))
    
    
do{
    
	if(Defence == 0){
		do{
		defense();
		}
		while(1);
		
	}else if((Play1 == 0) & (Play2 == 0) & (Defence == 1)){
		do{
		play_1();
		} while(1);
	}
	
} while(1);

}
Пример #2
0
  Pokemon* User::GetOpponentPokemonFromServer (yap::IPacket& packet)
  {
    yap::ID staticID = packet.ReadID ();
    yap::Gender gender =
      static_cast<yap::Gender>(packet.ReadUChar ());
    bool shiny = packet.ReadBool ();
    yap::ID nature = packet.ReadID ();
    yap::uint experience = packet.ReadUInt ();

    // Read the Pokemon's IV value
    yap::UInt16 hpIV = packet.ReadUInt16 ();
    yap::UInt16 attackIV = packet.ReadUInt16 ();
    yap::UInt16 defenseIV = packet.ReadUInt16 ();
    yap::UInt16 specialAttackIV = packet.ReadUInt16 ();
    yap::UInt16 specialDefenseIV = packet.ReadUInt16 ();
    yap::UInt16 speedIV = packet.ReadUInt16 ();

    // Set the stats with EV and IV
    yap::HitPoint hp (hpIV);
    yap::Attack attack (attackIV);
    yap::Defense defense (defenseIV);
    yap::SpecialAttack specialAttack (specialAttackIV);
    yap::SpecialDefense specialDefense (specialDefenseIV);
    yap::Speed speed (speedIV);

    yap::PokemonStat stats (
      hp,
      attack,
      defense,
      specialAttack,
      specialDefense,
      speed);

    // Read the Pokemon's move
    yap::PokemonMoveSet moveSet;
    yap::UInt8 moveNumber = packet.ReadUChar ();

    for (int index = 0; index < moveNumber; index++)
    {
      yap::PokemonMove* move = new yap::PokemonMove (packet.ReadID ());
      yap::UInt8 moveIndex = packet.ReadUChar ();

      move->SetPP (packet.ReadUInt16 ());
      move->SetMaxPP (packet.ReadUInt16 ());

      moveSet.AddMove (move, moveIndex);
    }

    return new Pokemon (
      staticID,
      stats,
      gender,
      shiny,
      moveSet,
      nature,
      experience);
  }
Пример #3
0
// private set ups
void Animation::setupEnter(){
	Point* p1 = new Point(-9.75, -5.0);	Point* p2 = new Point(-9.25, -5.0);	Point* p3 = new Point(-8.75, -5.0);
	Point* p4 = new Point(-8.25, -5.0);	Point* p5 = new Point(-7.75, -5.0);	Point* p6 = new Point(-7.25, -5.0);
	Point* p7 = new Point(-6.75, -5.0);	Point* p8 = new Point(-6.25, -5.0);	Point* p9 = new Point(-5.75, -5.0);
	Point* p10 = new Point(-5.25, -5.0); Point* p11 = new Point(-4.75, -5.0); Point* p12 = new Point(-4.25, -5.0);
	Point* p13 = new Point(-3.75, -5.0); Point* p14 = new Point(-3.25, -5.0); Point* p15 = new Point(-2.75, -5.0);
	Point* p16 = new Point(-2.25, -5.0); Point* p17 = new Point(-1.75, -5.0); Point* p18 = new Point(-1.25, -5.0);
	Rectangle1 nostep(5.0, 5.0, Point(-10.75, -5.0), "data/character/nostep",UserManager::getProfile().getColor());
	Rectangle1 step(5.0, 5.0, Point(-10.25, -5.0), "data/character/step",UserManager::getProfile().getColor());
	Rectangle1 draw1(5.0, 5.0, Point(-1.25, -5.0), "data/character/draw1",UserManager::getProfile().getColor());
	Rectangle1 draw2(5.0, 5.0, Point(-1.25, -5.0), "data/character/draw2",UserManager::getProfile().getColor());
	Rectangle1 draw3(5.0, 5.0, Point(-1.25, -5.0), "data/character/draw3",UserManager::getProfile().getColor());
	Rectangle1 defense(5.0, 5.0, Point(-1.25, -5.0), "data/character/defensivestance",UserManager::getProfile().getColor());
	enter.push_back(nostep); enter.push_back(step); nostep.setPoint(p1); step.setPoint(p2);
	enter.push_back(nostep); enter.push_back(step);	nostep.setPoint(p3); step.setPoint(p4);
	enter.push_back(nostep); enter.push_back(step);	nostep.setPoint(p5); step.setPoint(p6);
	enter.push_back(nostep); enter.push_back(step);	nostep.setPoint(p7); step.setPoint(p8);
	enter.push_back(nostep); enter.push_back(step);	nostep.setPoint(p9); step.setPoint(p10);
	enter.push_back(nostep); enter.push_back(step);	nostep.setPoint(p11); step.setPoint(p12);
	enter.push_back(nostep); enter.push_back(step);	nostep.setPoint(p13); step.setPoint(p14);
	enter.push_back(nostep); enter.push_back(step);	nostep.setPoint(p15); step.setPoint(p16);
	enter.push_back(nostep); enter.push_back(step);	nostep.setPoint(p17); step.setPoint(p18);
	enter.push_back(nostep); enter.push_back(step);	enter.push_back(draw1);	enter.push_back(draw2);	enter.push_back(draw3);	enter.push_back(defense);
	Rectangle1 monster(5.0, 5.0, Point(10.5, -6), "data/monster/" + mon);
	enemyEnter.push_back(monster); Point* point = new Point(10.0, -6); monster.setPoint(point);
	enemyEnter.push_back(monster); point = new Point(9.5, -6); monster.setPoint(point);
	enemyEnter.push_back(monster); point = new Point(9.0, -6); monster.setPoint(point);
	enemyEnter.push_back(monster); point = new Point(8.5, -6); monster.setPoint(point);
	enemyEnter.push_back(monster); point = new Point(8.0, -6); monster.setPoint(point);
	enemyEnter.push_back(monster); point = new Point(7.5, -6); monster.setPoint(point);
	enemyEnter.push_back(monster); point = new Point(7.0, -6); monster.setPoint(point);
	enemyEnter.push_back(monster); point = new Point(6.5, -6); monster.setPoint(point);
	enemyEnter.push_back(monster); point = new Point(6.0, -6); monster.setPoint(point);
	enemyEnter.push_back(monster); point = new Point(5.5, -6); monster.setPoint(point);
	enemyEnter.push_back(monster); point = new Point(4.0, -6); monster.setPoint(point);
	enemyEnter.push_back(monster); point = new Point(3.5, -6); monster.setPoint(point);
	enemyEnter.push_back(monster); point = new Point(3.0, -6); monster.setPoint(point);
	enemyEnter.push_back(monster); point = new Point(2.5, -6); monster.setPoint(point);
	enemyEnter.push_back(monster); enemyEnter.push_back(monster); enemyEnter.push_back(monster); 
	enemyEnter.push_back(monster); enemyEnter.push_back(monster); enemyEnter.push_back(monster);
	enemyEnter.push_back(monster); enemyEnter.push_back(monster); enemyEnter.push_back(monster);
	enemyEnter.push_back(monster);
}
Пример #4
0
void Animation::setupVictory(){
	Point p1 = this->startp;//startp;
	Point p2 = Point(p1.getX(), -4.5);
	Point p3 = Point(p1.getX(), -4);
	//Point p1(-1.25, -5);
	//Point p2(-1.25, -4.5);
	//Point p3(-1.25, -4);
	Rectangle1 defense(5.0, 5.0, p1, "data/character/defensivestance",UserManager::getProfile().getColor());
	Rectangle1 victory1(5.0, 5.0, p1, "data/character/victory1",UserManager::getProfile().getColor());
	Rectangle1 victory2(5.0, 5.0, p1, "data/character/victory2",UserManager::getProfile().getColor());
	Rectangle1 victory3(5.0, 5.0, p2, "data/character/victory1",UserManager::getProfile().getColor());
	Rectangle1 victory4(5.0, 5.0, p3, "data/character/victory1",UserManager::getProfile().getColor());
	Rectangle1 victory5(5.0, 5.0, p2, "data/character/victory1",UserManager::getProfile().getColor());
	victory.push_back(defense);
	victory.push_back(victory1); victory.push_back(victory2);
	victory.push_back(victory3); victory.push_back(victory4);
	victory.push_back(victory5); victory.push_back(victory1);
	victory.push_back(victory2); victory.push_back(victory3);
	victory.push_back(victory4); victory.push_back(victory5);
}
Пример #5
0
  Pokemon* User::GetPlayerPokemonFromServer (yap::IPacket& packet)
  {
    yap::ID staticID = packet.ReadID ();
    yap::ID uniqueID = packet.ReadID ();
    yap::Gender gender =
      static_cast<yap::Gender>(packet.ReadUChar ());
    yap::PokemonStatus status =
      static_cast<yap::PokemonStatus>(packet.ReadUChar ());
    yap::String nickname = packet.ReadString ();
    bool shiny = packet.ReadBool ();
    yap::Int16 loyalty = packet.ReadInt16 ();
    yap::ID nature = packet.ReadID ();
    yap::uint experience = packet.ReadUInt ();
    yap::UInt8 boxNumber = packet.ReadUChar ();
    yap::ID boxIndex = packet.ReadID ();
    yap::String catchDate = packet.ReadString ();
    yap::UInt16 currentHP = packet.ReadUInt16 ();

    // Read the Pokemon's EV value
    yap::UInt16 hpEV = packet.ReadUInt16 ();
    yap::UInt16 attackEV = packet.ReadUInt16 ();
    yap::UInt16 defenseEV = packet.ReadUInt16 ();
    yap::UInt16 specialAttackEV = packet.ReadUInt16 ();
    yap::UInt16 specialDefenseEV = packet.ReadUInt16 ();
    yap::UInt16 speedEV = packet.ReadUInt16 ();

    // Read the Pokemon's IV value
    yap::UInt16 hpIV = packet.ReadUInt16 ();
    yap::UInt16 attackIV = packet.ReadUInt16 ();
    yap::UInt16 defenseIV = packet.ReadUInt16 ();
    yap::UInt16 specialAttackIV = packet.ReadUInt16 ();
    yap::UInt16 specialDefenseIV = packet.ReadUInt16 ();
    yap::UInt16 speedIV = packet.ReadUInt16 ();

    // Set the stats with EV and IV
    yap::HitPoint hp (currentHP, hpEV, hpIV);
    yap::Attack attack (attackEV, attackIV);
    yap::Defense defense (defenseEV, defenseIV);
    yap::SpecialAttack specialAttack (specialAttackEV, specialAttackIV);
    yap::SpecialDefense specialDefense (specialDefenseEV, specialDefenseIV);
    yap::Speed speed (speedEV, speedIV);

    yap::PokemonStat stats (
      hp,
      attack,
      defense,
      specialAttack,
      specialDefense,
      speed);

    // Read the Pokemon's move
    yap::PokemonMoveSet moveSet;
    yap::UInt8 moveNumber = packet.ReadUChar ();

    for (int index = 0; index < moveNumber; index++)
    {
      yap::PokemonMove* move = new yap::PokemonMove (packet.ReadID ());
      yap::UInt8 moveIndex = packet.ReadUChar ();

      move->SetPP (packet.ReadUInt16 ());
      move->SetMaxPP (packet.ReadUInt16 ());

      moveSet.AddMove (move, moveIndex);
    }

    return new Pokemon (
      uniqueID,
      staticID,
      login_,
      nickname,
      stats,
      gender,
      status,
      shiny,
      loyalty,
      moveSet,
      nature,
      experience,
      boxNumber,
      boxIndex,
      catchDate);
  }