Пример #1
0
 /**
  * @param Fighter $fighter
  * @return int
  */
 private function getScore($fighter)
 {
     /**
      * @var Stats $stats
      */
     $stats = $fighter->getStats();
     $score = $stats->getStamina() + $stats->getStrength() + $stats->getAgility() + $stats->getIntelligence() + $stats->getStrike() + $stats->getGrappling() + $stats->getTakedown() + $stats->getKicking();
     $MINVALUE = 75;
     $MAXVALUE = 125;
     $randomFactor = rand($MINVALUE, $MAXVALUE) / 100;
     return $score * $randomFactor;
 }
Пример #2
0
 public function load(ObjectManager $manager)
 {
     $fighter1 = new Fighter();
     $fighter1->setName('Gica Spoitoru');
     $fighter1->setManager($this->getReference("man1"));
     $fighter1->setAvatar('avatar1.jpg');
     $manager->persist($fighter1);
     $fighter2 = new Fighter();
     $fighter2->setName('Mad Pony');
     $fighter2->setManager($this->getReference("man1"));
     $fighter2->setAvatar('avatar2.jpg');
     $manager->persist($fighter2);
     $fighter3 = new Fighter();
     $fighter3->setName('Perversu Pe Tg Ocna');
     $fighter3->setManager($this->getReference("man2"));
     $fighter3->setAvatar('avatar3.jpg');
     $manager->persist($fighter3);
     $fighter4 = new Fighter();
     $fighter4->setName('Fighter no.4');
     $fighter4->setManager($this->getReference("man1"));
     $fighter4->setAvatar('avatar4.jpg');
     $manager->persist($fighter4);
     $fighter5 = new Fighter();
     $fighter5->setName('Fighter no.5');
     $fighter5->setManager($this->getReference("man1"));
     $fighter5->setAvatar('avatar4.jpg');
     $manager->persist($fighter5);
     $fighter6 = new Fighter();
     $fighter6->setName('Fighter no.6');
     $fighter6->setManager($this->getReference("man1"));
     $fighter6->setAvatar('avatar4.jpg');
     $manager->persist($fighter6);
     $fighter7 = new Fighter();
     $fighter7->setName('Fighter no.7');
     $fighter7->setManager($this->getReference("man1"));
     $fighter7->setAvatar('avatar4.jpg');
     $manager->persist($fighter7);
     $fighter8 = new Fighter();
     $fighter8->setName('Fighter no.8');
     $fighter8->setManager($this->getReference("man1"));
     $fighter8->setAvatar('avatar4.jpg');
     $manager->persist($fighter8);
     $fighter9 = new Fighter();
     $fighter9->setName('Fighter no.9');
     $fighter9->setManager($this->getReference("man1"));
     $fighter9->setAvatar('avatar4.jpg');
     $manager->persist($fighter9);
     $fighter10 = new Fighter();
     $fighter10->setName('Fighter no.10');
     $fighter10->setManager($this->getReference("man1"));
     $fighter10->setAvatar('avatar4.jpg');
     $manager->persist($fighter10);
     $fighter11 = new Fighter();
     $fighter11->setName('Fighter no.11');
     $fighter11->setManager($this->getReference("man1"));
     $fighter11->setAvatar('avatar4.jpg');
     $manager->persist($fighter11);
     $fighter12 = new Fighter();
     $fighter12->setName('Fighter no.12');
     $fighter12->setManager($this->getReference("man1"));
     $fighter12->setAvatar('avatar4.jpg');
     $manager->persist($fighter12);
     $fighter13 = new Fighter();
     $fighter13->setName('Fighter no.13');
     $fighter13->setManager($this->getReference("man1"));
     $fighter13->setAvatar('avatar4.jpg');
     $manager->persist($fighter13);
     $fighter14 = new Fighter();
     $fighter14->setName('Fighter no.14');
     $fighter14->setManager($this->getReference("man1"));
     $fighter14->setAvatar('avatar4.jpg');
     $manager->persist($fighter14);
     $fighter15 = new Fighter();
     $fighter15->setName('Fighter no.15');
     $fighter15->setManager($this->getReference("man1"));
     $fighter15->setAvatar('avatar4.jpg');
     $manager->persist($fighter15);
     $fighter16 = new Fighter();
     $fighter16->setName('Fighter no.16');
     $fighter16->setManager($this->getReference("man1"));
     $fighter16->setAvatar('avatar4.jpg');
     $manager->persist($fighter16);
     $manager->flush();
     $this->addReference('fighter1', $fighter1);
     $this->addReference('fighter2', $fighter2);
     $this->addReference('fighter3', $fighter3);
     $this->addReference('fighter4', $fighter4);
     $this->addReference('fighter5', $fighter5);
     $this->addReference('fighter6', $fighter6);
     $this->addReference('fighter7', $fighter7);
     $this->addReference('fighter8', $fighter8);
     $this->addReference('fighter9', $fighter9);
     $this->addReference('fighter10', $fighter10);
     $this->addReference('fighter11', $fighter11);
     $this->addReference('fighter12', $fighter12);
     $this->addReference('fighter13', $fighter13);
     $this->addReference('fighter14', $fighter14);
     $this->addReference('fighter15', $fighter15);
     $this->addReference('fighter16', $fighter16);
 }