3 #include <BLIB/Render/Primitives/Color.hpp>
4 #include <BLIB/Util/Random.hpp>
18 const glm::vec2 TextPos(12.f, 473.f);
19 constexpr
float TextWidth = 470.f;
20 const glm::vec2 ArrowPos(468.f, 573.f);
21 constexpr
float TriangleFlashOn = 0.75f;
22 constexpr
float TriangleFlashOff = 0.65f;
24 using Message = cmd::Message;
26 std::string ailmentBlockedSuffix(
Message::Type tp,
const std::string& ppl) {
28 case Message::Type::AilmentSatPassiveAilmentBlocked:
29 return " but " + ppl +
" is Ailment Saturated!";
30 case Message::Type::SubstituteAilmentBlocked:
31 case Message::Type::SubstitutePassiveAilmentBlocked:
32 return " but it's Substitute blocks ailments!";
33 case Message::Type::GuardBlockedAilment:
34 case Message::Type::GuardBlockedPassiveAilment:
35 return " but it is Guarded!";
36 case Message::Type::PassiveAilmentGiveFail:
37 case Message::Type::AilmentGiveFail:
39 return " but it failed!";
43 std::string snackShareSuffix(
Message::Type type,
const std::string& other) {
45 case Message::Type::GainedAilmentSnackshare:
46 return " because of " + other +
"'s Snack Share!";
47 case Message::Type::GainedAilment:
56 , state(State::Hidden)
58 , keyboard(engine, std::bind(&
MessagePrinter::nameEntered, this)) {}
62 engine.renderer().getObserver(),
63 bl::menu::ArrowSelector::create(8.f, sf::Color::Black));
65 triangle.create(engine, {0.f, 0.f}, {12.f, 5.5f}, {0.f, 11.f});
66 triangle.getTransform().setPosition(ArrowPos);
67 triangle.setFillColor(bl::sfcol(sf::Color(242, 186, 17)));
68 triangle.flash(TriangleFlashOn, TriangleFlashOff);
71 text.getTransform().setPosition(TextPos);
72 text.wordWrap(TextWidth);
74 inputDriver.drive(&menu);
77 menu.setRootItem(yesItem);
78 menu.addItem(no, yesItem.get(), bl::menu::Item::Bottom);
79 menu.configureBackground(sf::Color::White, sf::Color::Black, 2.f, {14.f, 10.f, 0.f, 0.f});
80 menu.setPosition({490.f - menu.getBounds().width * 2.f, 450.f - menu.getBounds().height * 2.f});
82 yesItem->getSignal(bl::menu::Item::Activated)
83 .willAlwaysCall(std::bind(&MessagePrinter::makeChoice,
this,
true));
84 no->getSignal(bl::menu::Item::Activated)
85 .willAlwaysCall(std::bind(&MessagePrinter::makeChoice,
this,
false));
88 menu.addToScene(scene);
89 triangle.addToScene(scene, bl::rc::UpdateSpeed::Static);
90 text.addToScene(scene, bl::rc::UpdateSpeed::Static);
99 const std::string& ppl = battler.activePeoplemon().base().name();
103 setState(State::Printing);
105 switch (msg.getType()) {
106 case Message::Type::Attack:
111 case Message::Type::Callback:
112 if (forPlayer) { dispText =
"Come back " + ppl +
"!"; }
113 else { dispText = state.
enemy().
name() +
" called back " + ppl +
"!"; }
116 case Message::Type::SendOut:
117 if (forPlayer) { dispText =
"Go " + ppl +
"!"; }
118 else { dispText = state.
enemy().
name() +
" sent out " + ppl +
"!"; }
121 case Message::Type::SuperEffective:
122 dispText =
"It was super effective!";
125 case Message::Type::NotEffective:
126 dispText =
"It was not very effective";
129 case Message::Type::IsNotAffected:
130 dispText = other +
" is not affected by " +
132 battler.activePeoplemon().base().knownMoves()[battler.chosenMove()].id);
135 case Message::Type::CriticalHit:
136 dispText =
"It was a critical hit!";
139 case Message::Type::NetworkIntro:
140 dispText =
"Your friend " + state.
enemy().
name() +
" wants to fight!";
143 case Message::Type::TrainerIntro:
144 dispText = state.
enemy().
name() +
" wants to battle!";
147 case Message::Type::WildIntro:
148 dispText =
"A wild " + state.
enemy().
name() +
" attacked!";
151 case Message::Type::PlayerFirstSendout:
155 case Message::Type::OpponentFirstSendout:
160 case Message::Type::AttackMissed:
161 dispText =
"But it missed!";
164 case Message::Type::AttackRestoredHp:
165 dispText = ppl +
" had it's HP restored!";
168 case Message::Type::GainedAilment:
169 case Message::Type::GainedAilmentSnackshare:
170 switch (msg.getAilment()) {
172 dispText = ppl +
" became Annoyed" + snackShareSuffix(msg.getType(), other);
175 dispText = ppl +
" was Frozen" + snackShareSuffix(msg.getType(), other);
178 dispText = ppl +
" became Frustrated" + snackShareSuffix(msg.getType(), other);
181 dispText = ppl +
" was afflicted by Sleep" + snackShareSuffix(msg.getType(), other);
184 dispText = ppl +
" became Sticky" + snackShareSuffix(msg.getType(), other);
188 dispText =
"<ERROR: Invalid ailment specified in ailment message>";
193 case Message::Type::AilmentGiveFail:
194 case Message::Type::SubstituteAilmentBlocked:
195 case Message::Type::GuardBlockedAilment:
196 switch (msg.getAilment()) {
198 dispText = other +
" tried to Annoy " + ppl + ailmentBlockedSuffix(msg.getType(), ppl);
201 dispText = other +
" tried to Freeze " + ppl + ailmentBlockedSuffix(msg.getType(), ppl);
205 other +
" tried to Frustrate " + ppl + ailmentBlockedSuffix(msg.getType(), ppl);
208 dispText = other +
" tried to make " + ppl +
" fall asleep" +
209 ailmentBlockedSuffix(msg.getType(), ppl);
212 dispText = other +
" tried to make " + ppl +
" Sticky" +
213 ailmentBlockedSuffix(msg.getType(), ppl);
217 dispText =
"<ERROR: Invalid ailment specified in ailment message>";
222 case Message::Type::GainedPassiveAilment:
223 switch (msg.getPassiveAilment()) {
225 dispText = ppl +
" became Confused!";
228 dispText = ppl +
" is now Distracted!";
231 dispText = ppl +
" was Jumped!";
234 dispText = ppl +
" became Trapped!";
238 dispText =
"<ERROR: Invalid passive ailment specified in ailment message>";
243 case Message::Type::PassiveAilmentGiveFail:
244 case Message::Type::SubstitutePassiveAilmentBlocked:
245 case Message::Type::GuardBlockedPassiveAilment:
246 case Message::Type::AilmentSatPassiveAilmentBlocked:
247 switch (msg.getPassiveAilment()) {
250 other +
" tried to Confuse " + ppl + ailmentBlockedSuffix(msg.getType(), ppl);
254 other +
" tried to Distract " + ppl + ailmentBlockedSuffix(msg.getType(), ppl);
257 dispText = other +
" tried to Jump " + ppl + ailmentBlockedSuffix(msg.getType(), ppl);
260 dispText = other +
" tried to Trap " + ppl + ailmentBlockedSuffix(msg.getType(), ppl);
264 dispText =
"<ERROR: Invalid passive ailment specified in ailment message>";
269 case Message::Type::GenericMoveFailed:
270 dispText =
"But it failed!";
273 case Message::Type::WasProtected:
274 dispText =
"But " + ppl +
" Protected itself!";
277 case Message::Type::Guarded:
278 dispText = ppl +
" became Guarded!";
281 case Message::Type::GuardFailed:
282 dispText = ppl +
" tried to Guard themselves but they are already Guarded!";
285 case Message::Type::SubstituteSuicide:
286 dispText = ppl +
" tried to create a Substitute but killed themself instead!";
289 case Message::Type::SubstituteAlreadyExists:
290 dispText = ppl +
" tried to create a Substitute but they already have one!";
293 case Message::Type::SubstituteCreated:
294 dispText = ppl +
" created a Substitute!";
297 case Message::Type::SubstituteTookDamage:
298 dispText = ppl +
"'s Substitute took damage in their place!";
301 case Message::Type::SubstituteDied:
302 dispText = ppl +
"'s Substitute was killed!";
305 case Message::Type::HealBellHealed:
306 dispText = ppl +
"'s Heal Bell made their entire party healthy!";
309 case Message::Type::HealBellAlreadyHealthy:
310 dispText = ppl +
" tried to use their Heal Bell to make their party healthy but everyone "
311 "is already healthy!";
314 case Message::Type::StatIncreased:
318 case Message::Type::StatIncreasedSharply:
322 case Message::Type::StatIncreaseFailed:
327 case Message::Type::StatDecreased:
331 case Message::Type::StatDecreasedSharply:
335 case Message::Type::StatDecreaseFailed:
340 case Message::Type::RecoilDamage:
341 dispText = ppl +
" was hurt by Recoil!";
344 case Message::Type::ChargeStarted:
345 dispText = ppl +
" began charging power!";
348 case Message::Type::ChargeUnleashed:
349 dispText = ppl +
" unleashed power!";
352 case Message::Type::SuicideEffect:
353 dispText = ppl +
" killed itself!";
356 case Message::Type::CounterEffect:
357 dispText = ppl +
" was hurt by Counter!";
360 case Message::Type::OnlySleepAffected:
361 dispText =
"It had no effect because " + other +
" is not sleeping!";
364 case Message::Type::PeanutAllergic:
365 dispText = ppl +
" had an allergic reaction and died!";
368 case Message::Type::PeanutAte:
369 dispText = ppl +
" ate the peanut and gained HP!";
372 case Message::Type::EveryoneWokenUp:
373 dispText =
"It is physically impossible for anyone in a 15 mile radius to still be asleep "
377 case Message::Type::EncoreStart:
378 dispText = other +
" is trying to make " + ppl +
" do an Encore!";
381 case Message::Type::EncoreFailed:
382 dispText = ppl +
" cannot do an Encore now!";
385 case Message::Type::RandomMove:
390 case Message::Type::BatonPassFailed:
391 dispText = ppl +
" tried to use Baton Pass to switch out but no one is there to help!";
394 case Message::Type::BatonPassStart:
395 dispText = ppl +
"'s Baton Pass lets them switch out!";
398 case Message::Type::BatonPassStatsCopied:
399 dispText = ppl +
" received " + battler.peoplemon()[msg.getInt()].base().name() +
400 "'s stats via Baton Pass!";
403 case Message::Type::DeathCountDown:
404 dispText = ppl +
" has been Marked for Death! They better get out of here!";
407 case Message::Type::DeathFromCountdown:
408 dispText = ppl +
" died from their Mark of Death! Should have gotten out of here when they "
412 case Message::Type::DeathCountDownFailed:
413 dispText = ppl +
" tried to mark themself and " + other +
414 " for death but they are both already doomed!";
417 case Message::Type::GambleOne:
418 dispText = ppl +
" rolled a 1 and was reduced to 1 HP!";
421 case Message::Type::GambleTwenty:
422 dispText = ppl +
" rolled a 20!! Attack power is increased to 200!";
425 case Message::Type::GambleMiddle:
426 dispText = ppl +
" rolled a " + std::to_string(msg.getInt()) +
"! Attack power is " +
427 std::to_string(msg.getInt() * 5) +
"!";
430 case Message::Type::Absorb:
431 dispText = ppl +
" absorbed HP from " + other +
"!";
434 case Message::Type::NoPPDeath:
435 dispText = ppl +
" has no PP and died of shame!";
438 case Message::Type::BallServed:
439 dispText = ppl +
" Served a volleyball out of nowhere! Better watch out.";
442 case Message::Type::BallBumped:
443 dispText = ppl +
" Bumped the volleyball!";
446 case Message::Type::BallSet:
447 dispText = ppl +
" Set the volleyball!";
450 case Message::Type::BallSetFail:
451 dispText = ppl +
" tried to Set a volleyball but there isn't one in play!";
454 case Message::Type::BallSpiked:
455 dispText = ppl +
" Spiked the volleyball!";
458 case Message::Type::BallSpikeFail:
459 dispText = ppl +
" tried to Spike a volleyball but there isn't one in play!";
462 case Message::Type::BallSwiped:
463 dispText = ppl +
" Swiped the volleyball!";
466 case Message::Type::BallSwipeFail:
467 dispText = ppl +
" tried to Swipe a volleyball but there isn't one in play!";
470 case Message::Type::BallBlocked:
471 dispText = ppl +
" is preparing to Block a Spike!";
474 case Message::Type::BallBlockFail:
475 dispText = ppl +
" got ready to Block a Spike, but no one has a ball!";
478 case Message::Type::BallSpikeBlocked:
479 dispText = ppl +
"'s Spike was Blocked by " + other +
" and they died of shame!";
482 case Message::Type::BallSwipeBlocked:
483 dispText = other +
" did not Block so " + ppl +
"'s Swipe didn't work! They died of shame.";
486 case Message::Type::BallKillSelf:
487 dispText = ppl +
" forgot to keep the volleyball in the air and died of shame!";
490 case Message::Type::BallKillSpike:
491 dispText = ppl +
" was killed by " + other +
"'s Spike!";
494 case Message::Type::BallKillSwipe:
495 dispText = ppl +
" was killed by " + other +
"'s Swipe!";
498 case Message::Type::BallKillTimeout:
499 dispText = ppl +
" had the volleyball on their side too long and died of shame!";
502 case Message::Type::BallNoSwitchSuicide:
503 dispText = ppl +
" has no one else on their team to hit the ball and died of shame!";
506 case Message::Type::MaxAtkMinAcc:
507 dispText = ppl +
"'s ATK was maxed but their ACC is trashed!";
510 case Message::Type::PPLowered:
511 dispText = ppl +
" lowered " + other +
"'s PP";
514 case Message::Type::PPLowerFail:
515 dispText = ppl +
" tried to lower " + other +
"'s PP but they were able to keep it up!";
518 case Message::Type::EndureStart:
519 dispText = ppl +
" is doing their best to Endure and not die!";
522 case Message::Type::Endured:
523 dispText = ppl +
" was able to Endure and survive!";
526 case Message::Type::EndureFail:
527 dispText = ppl +
" tried to Endure but failed and is just as mortal as the rest of us!";
530 case Message::Type::SpikesApplied:
531 dispText = other +
" threw a bunch of Spikes around " + ppl +
532 "! They better not move around too much.";
535 case Message::Type::SpikesDamage:
536 dispText = ppl +
" took damage from stepping on the Spikes around them!";
539 case Message::Type::SpikesFailed:
540 dispText = other +
" tried to throw more Spikes around " + ppl +
541 " but it's too messy so they gave up!";
544 case Message::Type::DoubleBroPower:
545 dispText = ppl +
"'s Bro Attack Power was increased by " + std::to_string(msg.getInt()) +
546 " Total Bros in their party!";
549 case Message::Type::HealNextStart:
551 ppl +
" threw some weird powder into the air that will take exactly one turn to fall!";
554 case Message::Type::HealNextHealed:
555 dispText = ppl +
" was healed by the falling powder!";
558 case Message::Type::HealNextFail:
559 dispText = ppl +
" tried to throw powder in the air again but the powder already there got "
563 case Message::Type::Move64Cancel:
565 " due to trauma from being Kicked!";
568 case Message::Type::Roar:
569 dispText = ppl +
" ran away in fear!";
572 case Message::Type::RoarFailedNoSwitch:
573 dispText = ppl +
" wants to cower in fear but there is no one to take their place!";
576 case Message::Type::RoarClearedArea:
578 ppl +
"'s Roar was so strong that all the spikes and volleyballs got blown away!";
581 case Message::Type::StatsStolen:
582 dispText = ppl +
" stole all of " + other +
"'s stat changes!";
585 case Message::Type::AttackThenSwitched:
586 dispText = ppl +
" is able to return to their ball!";
589 case Message::Type::AttackSwitchFailed:
590 if (battler.peoplemon().size() > 1) {
591 dispText = ppl +
" tried to retreat but all of their friends are dead!";
593 else { dispText = ppl +
" tried to retreat but they don't have any friends!"; }
596 case Message::Type::SleepHealed:
597 dispText = ppl +
" went to Sleep to try and fix their problems!";
600 case Message::Type::SleepHealFailed:
601 dispText = ppl +
" tried to Sleep to ignore their problems but stayed wide awake!";
604 case Message::Type::WokeUp:
605 dispText = ppl +
" woke up!";
608 case Message::Type::DeathSwapSac:
609 dispText = ppl +
" sacrificed themselves to revive a teammate!";
612 case Message::Type::DeathSwapFailed:
613 dispText = ppl +
" tried to sacrifice themselves but can't even get that right!";
616 case Message::Type::DeathSwapRevived:
617 dispText = ppl +
"'s Sacrifice revived " +
618 battler.peoplemon()[battler.chosenPeoplemon()].base().name() +
"!";
622 case Message::Type::Fainted:
623 dispText = ppl +
" \"fainted\" from terrible physical trauma!";
626 case Message::Type::TrainerLost:
631 case Message::Type::WonMoney:
632 dispText = state.
localPlayer().
name() +
" won " + std::to_string(msg.getInt()) +
" monies!";
635 case Message::Type::WhiteoutA:
639 case Message::Type::WhiteoutB:
643 case Message::Type::NetworkWinLose:
645 dispText =
"You have beaten your acquaintance " + state.
enemy().
name() +
646 " at the most advanced fighting game!";
648 else { dispText =
"A person you know named " + state.
enemy().
name() +
" has shamed you!"; }
651 case Message::Type::AwardedXp:
653 std::to_string(msg.getUnsigned()) +
" XP!";
656 case Message::Type::LevelUp:
663 case Message::Type::TryingToLearnMove:
666 " but already knows 4 moves!";
669 case Message::Type::ForgotMove:
674 case Message::Type::LearnedMove:
679 case Message::Type::DidntLearnMove:
684 case Message::Type::AskForgetMove:
685 setState(State::PrintingYesNoChoice);
689 case Message::Type::IsConfused:
690 dispText = ppl +
" is Confused!";
693 case Message::Type::HurtConfusion:
694 dispText = ppl +
" hurt themselves in Confusion!";
697 case Message::Type::SnappedConfusion:
698 dispText = ppl +
" snapped out of Confusion!";
701 case Message::Type::StolenAilment:
702 dispText = ppl +
" had it's HP Stolen by " + other +
"!";
705 case Message::Type::TrappedAilment:
706 dispText = ppl +
" was Trapped by " + other +
"!";
709 case Message::Type::DistractedAilment:
710 dispText = ppl +
" was too Distracted to do anything!";
713 case Message::Type::AnnoyAilment:
714 dispText = ppl +
" was too Annoyed to move!";
717 case Message::Type::FrustratedAilment:
718 dispText = ppl +
" is physically hurt from pure Frustration!";
721 case Message::Type::StickyAilment:
722 dispText = ppl +
" is getting really hurt from being so Sticky!";
725 case Message::Type::SleepingAilment:
726 dispText = ppl +
" is Sleeping on the job!";
729 case Message::Type::FrozenAilment:
730 dispText = ppl +
" is Frozen and cannot move!";
733 case Message::Type::ThawedOut:
734 dispText = ppl +
" thawed out and is no longer Frozen!";
737 case Message::Type::BoardGameSwitchBlocked:
738 dispText = other +
"'s Board Game Master abilities prevents " + ppl +
" from leaving!";
741 case Message::Type::ChillaxCritBlocked:
742 dispText = ppl +
" is too Chillaxed to receive critical hits!";
745 case Message::Type::ClassyFrustratedBlocked:
746 dispText = other +
" tried to Frustrate " + ppl +
" but " + ppl +
747 " is too Classy to be Frustrated so easily!";
750 case Message::Type::GoonDamage:
751 dispText = ppl +
" got roughed up a bit because " + other +
" is a Goon!";
754 case Message::Type::QuickDrawFirst:
755 dispText = ppl +
"'s Quick Draw lets them move first!";
758 case Message::Type::FriendlyAilmentHeal:
759 dispText = battler.peoplemon()[msg.getInt()].base().name() +
760 " had their ailment healed because they are Always Friendly!";
763 case Message::Type::SassyDamage:
764 dispText = ppl +
" took some damage from " + other +
"'s Sassiness!";
767 case Message::Type::BeefyPower:
768 dispText = ppl +
" Beefed Up their Athletic attack out of desparation!";
771 case Message::Type::ReservedQuietPower:
772 dispText = ppl +
"'s Quiet move is powered up because they are Reserved and almost dead!";
775 case Message::Type::DukeOfJokes:
776 dispText = ppl +
" powers up Jokes because they are the Duke of Jokes!";
779 case Message::Type::EngagingAbility:
780 dispText =
pplmn::Move::name(msg.getMoveId()) +
" normally doesn't affect " + other +
781 " but " + ppl +
" is so Engaging that it's not very effective instead!";
784 case Message::Type::DerpDerpConfuse:
785 dispText = ppl +
" was Confused by " + other +
"'s Derpiness!";
788 case Message::Type::KlutzDrop:
790 " because they are a Klutz!";
793 case Message::Type::SidetrackDistract:
794 dispText = ppl +
" went on a Sidetrack and Distracted " + other +
"!";
797 case Message::Type::NoJokeTeachAbility:
798 dispText = ppl +
"'s Jokes will not work on " + other +
" while they are Teaching!";
801 case Message::Type::FieryTeachAbility:
802 dispText = ppl +
" got Fired Up from Teaching!";
805 case Message::Type::ExperiencedTeachAbility:
806 dispText = ppl +
" is too much of an Experienced Teacher to die while Teaching!";
809 case Message::Type::NewTeachAbility:
810 dispText = ppl +
" is slightly faster this turn because they are a New Teacher!";
813 case Message::Type::DozeOffAbility:
814 dispText = ppl +
"'s Teaching made " + other +
" Doze Off!";
817 case Message::Type::DouseFlamesAbility:
818 dispText = other +
" Doused the Flames of " + ppl +
"'s attack!";
821 case Message::Type::FlirtyAbility:
822 dispText = other +
"'s Flirtyness is disarming " + ppl +
"!";
825 case Message::Type::UndyingFaithAbility:
826 dispText = ppl +
"'s Undying Faith saved them from death!";
829 case Message::Type::TooCoolAbility:
830 dispText = other +
" tried to Annoy " + ppl +
" but " + ppl +
" is Too Cool for that!";
833 case Message::Type::FakeStudyAbility:
834 dispText = ppl +
" was too busy Fake Studying to attack!";
837 case Message::Type::AlcoholicAbility:
838 dispText = ppl +
" drank some alcohol from the bag because they are an Alcoholic!";
841 case Message::Type::AlcoholicAbilityFailed:
842 dispText = ppl +
" tried to get some alcohol from the bag but there isn't any!";
845 case Message::Type::TotalMomAbility: {
846 const std::string& mom = battler.peoplemon()[msg.getInt()].base().name();
847 dispText = ppl +
" had some PP restored by " + mom +
" because " + mom +
" is a Total Mom!";
850 case Message::Type::CantSwimAbility:
851 dispText = ppl +
"'s Accuracy is reduced because " + other +
" Can't Swim!";
854 case Message::Type::AllNighterAbility:
855 dispText = ppl +
" has pulled too many All Nighters to Sleep now!";
858 case Message::Type::AdamentAbility:
860 other +
" tried to get " + ppl +
" to leave, but " + ppl +
" is Adament on staying!";
863 case Message::Type::AbsPitchNotEffective:
864 dispText = ppl +
"'s Absolute Pitch weakens ineffective moves even more!";
867 case Message::Type::AbsPitchSuperEffective:
868 dispText = ppl +
"'s Absolute Pitch strengthens effective moves even more!";
871 case Message::Type::GameMakerVirusAbility:
872 dispText = ppl +
" had it's PP lowered by " + other +
"'s GameMaker Virus!";
875 case Message::Type::SnapshotAbility:
877 ppl +
"'s Snapshot prevents the same move from being super effective twice in a row!";
880 case Message::Type::GetBakedAbility:
881 dispText = ppl +
" is Getting Baked instead of listening!";
884 case Message::Type::PreUseItem:
888 case Message::Type::ItemUseResult:
893 case Message::Type::ItemNoEffect:
894 dispText =
"It had no effect! What a waste of time.";
897 case Message::Type::BagOfGoldfish:
898 dispText = ppl +
"'s ate from their Bag of Goldfish and regained HP!";
901 case Message::Type::BackwardsHoodyStatDown:
902 dispText = ppl +
"'s Backwards Hoodie makes their attacks more powerful!";
905 case Message::Type::BackwordsHoodyConfuse:
906 dispText = ppl +
" was Confused by " + other +
"'s Backwards Hoodie!";
909 case Message::Type::GlassesAcc:
910 dispText = ppl +
"'s Glasses increase ACC!";
913 case Message::Type::SlappingGloveDamage:
914 dispText = ppl +
"'s ATK is increased by their Slapping Glove!";
917 case Message::Type::SpoonDamage:
918 dispText = ppl +
"'s SPATK is increased by their Spoon!";
921 case Message::Type::SuperTinyMiniFridge:
922 dispText = ppl +
"'s Super Tiny Mini Fridge exploded!";
925 case Message::Type::SketchySack:
927 ppl +
" took damage from their Sketchy Sack that they are holding for some reason!";
930 case Message::Type::GoldfishCracker:
931 dispText = ppl +
" ate their abnormally large Goldfish Cracker and regained HP!";
934 case Message::Type::WakeUpBelle:
935 dispText = ppl +
" was woken up by their Wakeup Belle!";
938 case Message::Type::PowerJuice:
939 dispText = ppl +
" drank their Power Juice and increased attack power!";
942 case Message::Type::IcedTea:
943 dispText = ppl +
" drank their Iced Tea and increased defense!";
946 case Message::Type::SpeedJuice:
947 dispText = ppl +
" drank their Speed Juice and increased their speed!";
950 case Message::Type::RunFailedNotWild:
951 dispText =
"You can't run from this fight, coward!";
954 case Message::Type::RunFailed:
955 dispText =
"Tried to run away but " + ppl +
" was too slow and now it's awkward!";
958 case Message::Type::RunAway:
959 dispText =
"Got away safely!";
962 case Message::Type::PeopleballNoSteal:
963 dispText =
"You can't catch other people's Peoplemon! It's unethical!";
966 case Message::Type::PeopleballBrokeout:
967 switch (bl::util::Random::get<int>(0, 3)) {
969 dispText = ppl +
" broke out!";
972 dispText = ppl +
" is too squirmy!";
975 dispText = ppl +
" doesn't want to go out with you!";
978 dispText = ppl +
" is trying to get away and contact the police!";
983 case Message::Type::PeopleballCaught:
984 dispText = ppl +
" was caught!";
987 case Message::Type::AskToSetNickname:
988 setState(State::PrintingYesNoChoice);
989 dispText =
"Give " + ppl +
" a nickname?";
992 case Message::Type::AskForNickname:
993 setState(State::WaitingNameEntry);
994 dispText =
"What should " + ppl +
" be called?";
995 keyboard.
start(0, 32);
999 case Message::Type::SentToStorage:
1000 dispText = (keyboard.
value().empty() ? ppl : keyboard.
value()) +
" was sent to Storage.";
1003 case Message::Type::StorageFailed:
1004 dispText =
"Your Peoplemon storage is full! " +
1005 (keyboard.
value().empty() ? ppl : keyboard.
value()) +
1006 " was released to avoid a wrongful death lawsuit.";
1009 case Message::Type::PeoplemonCloned:
1010 dispText = ppl +
" was cloned! Holy shit!";
1013 case Message::Type::CloneFailed:
1014 dispText = ppl +
" could not be cloned!";
1017 case Message::Type::_ERROR:
1021 if (dispText.empty()) {
1022 BL_LOG_WARN <<
"Got bad message type: " << msg.getType();
1023 dispText =
"<BAD MESSAGE TYPE>";
1026 text.getSection().setString(dispText);
1027 writer.setContent(text.getSection().getString().toAnsiString());
1028 if (clear) text.getSection().setString(
"");
1033 case State::Printing:
1034 case State::PrintingYesNoChoice:
1035 case State::ShowingNotAcked:
1040 case State::WaitingYesNoChoice:
1041 inputDriver.sendControl(ctrl, fromEvent);
1043 case State::WaitingNameEntry:
1044 keyboard.
process(ctrl, fromEvent);
1051 void MessagePrinter::finishPrint() {
1053 case State::PrintingYesNoChoice:
1054 setState(State::WaitingYesNoChoice);
1057 case State::Printing:
1059 text.getSection().setString(std::string(writer.getVisible()));
1060 if (state == State::Printing) { setState(State::ShowingNotAcked); }
1063 case State::ShowingNotAcked:
1064 setState(State::ShowingAcked);
1075 return state == State::ShowingAcked || state == State::Hidden;
1080 case State::PrintingYesNoChoice:
1081 case State::Printing: {
1082 const std::size_t oldLen = writer.getVisible().size();
1084 if (oldLen != writer.getVisible().size()) {
1085 text.getSection().setString(std::string(writer.getVisible()));
1087 if (writer.finished()) {
1088 if (state == State::Printing) { setState(State::ShowingNotAcked); }
1089 else { setState(State::WaitingYesNoChoice); }
1099 if (state != State::Hidden) {
1103 case State::ShowingNotAcked:
1106 case State::WaitingYesNoChoice:
1115 void MessagePrinter::makeChoice(
bool f) {
1117 setState(State::Hidden);
1124 void MessagePrinter::nameEntered() { setState(State::Hidden); }
1128 void MessagePrinter::setState(State ns) {
1129 if (state == State::WaitingNameEntry) { keyboard.
stop(); }
1132 triangle.resetFlash();
1134 if (ns == State::WaitingNameEntry) { keyboard.
start(0, 32); }
Type
The type classification of an item. This is used to determine when an item may be used and how to use...
Core classes and functionality for both the editor and game.
std::underlying_type_t< Control::EntityControl > EntityControl
Helper typedef to avoid too much casting boilerplate.
Base class for battlers in the game. This provides storage for peoplemon and turn choices.
BattlerSubstate & getSubstate()
Returns the state of this battler.
bool canFight() const
Returns true if the battler has at least one non-fainted peoplemon.
core::pplmn::BattlePeoplemon & activePeoplemon()
Returns the peoplemon that is currently out.
bool isHost() const
Returns whether or not this battler is the host.
const std::string & name() const
Returns the name of the battler.
std::vector< core::pplmn::BattlePeoplemon > & peoplemon()
Returns all the peoplemon held by this battler.
component::Trainer * trainer
Stores and represents the current state of a battle. This is the base class for local and remote batt...
Battler & enemy()
Returns the opponent Battler.
Battler & activeBattler()
Returns the battler that is current resolving their turn.
Battler & localPlayer()
Returns the local player Battler.
Helper utility for printing battle messages.
const std::string & chosenNickname() const
Returns the nickname chosen by the player.
void process(input::EntityControl ctrl, bool ignoreDebounce)
Displays the full message. Call when user presses the continue button.
MessagePrinter(bl::engine::Engine &engine)
Construct a new Message Printer utility.
void update(float dt)
Updates the ghost writer.
void hide()
Hides the text once the view is fully synced.
bool messageDone() const
Returns true when the full message is on display and finishPrint() has been called.
void render(bl::rc::scene::CodeScene::RenderContext &ctx)
Renders the message.
bool choseToSetName() const
Whether or not the player chose to set a nickname.
void init(bl::rc::scene::CodeScene *scene)
Initializes the UI components and adds to scene.
bool choseToForget() const
Returns whether or not the player chose to forget a move.
void setMessage(BattleState &state, const cmd::Message &message)
Set the message to be printed.
const std::string & loseBattleDialog() const
Dialog line said in battle screen when battle is lost.
static std::string getUseLine(Id item, const pplmn::OwnedPeoplemon &ppl)
Returns the text to display when the item is used on the given peoplemon.
static const std::string & getName(item::Id item)
Returns the name of the given item.
OwnedPeoplemon & base()
Returns the wrapped peoplemon.
static const std::string & name(MoveId move)
Returns the name of the given move.
const std::string & name() const
Returns the name of this peoplemon, custom or defualt.
static const char * statToString(Stat stat)
Converts the given stat to its string representation.
static const sf::VulkanFont & MenuFont()
sf::Vector2f getSize() const
Returns the size of the screen keyboard.
void start(unsigned int minLen=0, unsigned int maxLen=16)
Subscribes the keyboard to the event bus.
void process(unsigned int ctrl, bool ignoreDebounce)
Handles player input.
void setPosition(const sf::Vector2f &position)
Sets the position of the keyboard. The default is (??)
void stop()
Unsubscribes the keyboard from the event bus.
const std::string & value() const
Returns the current input value.