Multi-emotion msg
This commit is contained in:
parent
8380f40638
commit
d55fda14fb
1 changed files with 40 additions and 10 deletions
|
@ -241,18 +241,48 @@ class Game
|
||||||
if(!$lowest_scoring_hit)
|
if(!$lowest_scoring_hit)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
|
||||||
|
/* @var $hitRepo HitRepository */
|
||||||
|
$hitRepo = Application::getInstance()->getEm()->getRepository(Hit::class);
|
||||||
|
|
||||||
$target = $lowest_scoring_hit->getTarget();
|
$target = $lowest_scoring_hit->getTarget();
|
||||||
|
$targets = $hitRepo->getTargetSetForTarget($target);
|
||||||
|
|
||||||
$emotion = $target->getEmotion();
|
$emotion = $target->getEmotion();
|
||||||
|
|
||||||
$exaggerate = ($target->getScore() - $hit->getEmotions()->getEmotionScore($emotion)) > 20 ? " only" : "";
|
$exaggerate = ($target->getScore() - $hit->getEmotions()->getEmotionScore($emotion)) > 20 ? " only" : "";
|
||||||
$exaggerate = ($target->getScore() - $hit->getEmotions()->getEmotionScore($emotion)) < -20 ? " a whopping" : $exaggerate;
|
$exaggerate = ($target->getScore() - $hit->getEmotions()->getEmotionScore($emotion)) < -20 ? " a whopping" : $exaggerate;
|
||||||
|
|
||||||
$text = "When you had to feel "
|
$text = "When you had to feel";
|
||||||
. $target->getScore() ."% " . $emotion->getName()
|
$i=0;
|
||||||
." you showed " . $exaggerate . round($hit->getEmotions()->getEmotionScore($emotion),3) ."%.";
|
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 .=".";
|
||||||
|
|
||||||
/* @var $hitRepo HitRepository */
|
|
||||||
$hitRepo = Application::getInstance()->getEm()->getRepository(Hit::class);
|
|
||||||
$betterHit = $hitRepo->getBetterHit($lowest_scoring_hit);
|
$betterHit = $hitRepo->getBetterHit($lowest_scoring_hit);
|
||||||
|
|
||||||
if(!empty($betterHit)) {
|
if(!empty($betterHit)) {
|
||||||
|
|
Loading…
Reference in a new issue