+ if (titleBarText) {
+ titleBarTimer = GraphicsTimers().StartCountdown(850);
+ textPosition = parent->ScreenOffset() + Vector<int>(
+ (parent->Width() - std::strlen(titleBarText) * parent->Res().titleFont->CharWidth()) / 2,
+ parent->Res().titleFrame->BorderHeight());
+ }
+ if (moveAnimation.Valid()) {
+ moveAnimation.Start(*this);
+ if (attack.IsMonster()) {
+ battle->MonsterAt(attack.index).SetAnimation(moveAnimation);
+ } else if (attack.IsHero()) {
+ battle->HeroAt(attack.index).SetAnimation(moveAnimation);
+ } else {
+ battle->GetCapsule().SetAnimation(moveAnimation);
+ }
+ }
+ if (targetAnimation.Valid()) {
+ targetAnimationTimer = GraphicsTimers().StartCountdown(150);
+ } else {
+ targetAnimationTimer.Clear();
+ }
+}
+
+void PerformAttacks::AddNumberAnimations(const TargetSelection &ts) {
+ if (ts.TargetsMonsters()) {
+ for (int i(0); i < battle->MaxMonsters(); ++i) {
+ if (ts.IsBad(i)) {
+ numberAnimation.push_back(NumberAnimation(ts.GetAmount(i), parent->Res().numberAnimationPrototype, parent->Res().bigNumberSprite));
+ numberPosition.push_back(
+ battle->MonsterAt(i).Position() + parent->ScreenOffset());
+ } else if (ts.IsGood(i)) {
+ numberAnimation.push_back(NumberAnimation(ts.GetAmount(i), parent->Res().numberAnimationPrototype, parent->Res().greenNumberSprite));
+ numberPosition.push_back(
+ battle->MonsterAt(i).Position() + parent->ScreenOffset());
+ }
+ }
+ } else {
+ for (int i(0); i < battle->NumHeroes(); ++i) {
+ if (ts.IsBad(i)) {
+ numberAnimation.push_back(NumberAnimation(ts.GetAmount(i), parent->Res().numberAnimationPrototype, parent->Res().bigNumberSprite));
+ numberPosition.push_back(
+ battle->HeroAt(i).Position() + parent->ScreenOffset());
+ } else if (ts.IsGood(i)) {
+ numberAnimation.push_back(NumberAnimation(ts.GetAmount(i), parent->Res().numberAnimationPrototype, parent->Res().greenNumberSprite));
+ numberPosition.push_back(
+ battle->HeroAt(i).Position() + parent->ScreenOffset());
+ }
+ }
+ }