diff --git a/src/Models/Game.php b/src/Models/Game.php index 62442ee..b88374a 100644 --- a/src/Models/Game.php +++ b/src/Models/Game.php @@ -240,19 +240,49 @@ class Game if(!$lowest_scoring_hit) return ""; - - $target = $lowest_scoring_hit->getTarget(); - $emotion = $target->getEmotion(); - - $exaggerate = ($target->getScore() - $hit->getEmotions()->getEmotionScore($emotion)) > 20 ? "only " : ""; - $exaggerate = ($target->getScore() - $hit->getEmotions()->getEmotionScore($emotion)) < -20 ? "a whopping " : $exaggerate; - - $text = "When you had to feel " - . $target->getScore() ."% " . $emotion->getName() - ." you showed " . $exaggerate . round($hit->getEmotions()->getEmotionScore($emotion),3) ."%."; + /* @var $hitRepo HitRepository */ $hitRepo = Application::getInstance()->getEm()->getRepository(Hit::class); + + $target = $lowest_scoring_hit->getTarget(); + $targets = $hitRepo->getTargetSetForTarget($target); + + $emotion = $target->getEmotion(); + + $exaggerate = ($target->getScore() - $hit->getEmotions()->getEmotionScore($emotion)) > 20 ? " only" : ""; + $exaggerate = ($target->getScore() - $hit->getEmotions()->getEmotionScore($emotion)) < -20 ? " a whopping" : $exaggerate; + + $text = "When you had to feel"; + $i=0; + foreach($targets as $t) { + $i++; + if($i > 1) { + if($i == count($targets)) { + $text .= " and"; + } else { + $text .=","; + } + } + /* @var $t Target */ + $text .= " " . $t->getScore() . "% ". $t->getEmotion()->getName(); + } + $text .= " you showed" . $exaggerate; + foreach($targets as $t) { + $i++; + if($i > 1) { + if($i == count($targets)) { + $text .= " and"; + } else { + $text .=","; + } + } + $targetHit = $hitRepo->findOneBy(['game' => $hit->getGame(), 'target' => $t]); + /* @var $t Target */ + $text .= " " . round($targetHit->getEmotions()->getEmotionScore($target->getEmotion()),2) . "% ". $t->getEmotion()->getName(); + } + $text .="."; + $betterHit = $hitRepo->getBetterHit($lowest_scoring_hit); if(!empty($betterHit)) {