Multi-emotion msg
This commit is contained in:
parent
8380f40638
commit
d55fda14fb
1 changed files with 40 additions and 10 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Reference in a new issue