+ } else {
+ for (int i(0); i < battle->NumHeroes(); ++i) {
+ if (ts.IsBad(i)) {
+ numberAnimation.push_back(NumberAnimation(ts.GetAmount(i), battle->Res().numberAnimationPrototype, battle->Res().bigNumberSprite));
+ numberPosition.push_back(
+ battle->HeroesPositions()[i]);
+ } else if (ts.IsGood(i)) {
+ numberAnimation.push_back(NumberAnimation(ts.GetAmount(i), battle->Res().numberAnimationPrototype, battle->Res().greenNumberSprite));
+ numberPosition.push_back(
+ battle->HeroesPositions()[i]);
+ }
+ }
+ }
+}
+
+void PerformAttacks::CheckAnimations() {
+ if (targetAnimation && targetAnimationTimer.JustHit()) {
+ targetAnimation->Start(*this);
+ }
+ if (moveAnimation && !moveAnimation->Finished()) return;
+ if (targetAnimation && !targetAnimation->Finished()) return;
+ if (moveAnimation || targetAnimation) {
+ moveAnimation = 0;
+ targetAnimation = 0;
+ for (vector<NumberAnimation>::iterator i(numberAnimation.begin()), end(numberAnimation.end()); i != end; ++i) {
+ i->Start(*this);
+ }
+ } else {
+ for (vector<NumberAnimation>::iterator i(numberAnimation.begin()), end(numberAnimation.end()); i != end; ++i) {
+ i->CheckTimers(*this);
+ }
+ }
+}
+
+bool PerformAttacks::HasAnimationsRunning() const {
+ if (titleBarTimer.Running()) return true;
+ if (moveAnimation && moveAnimation->Running()) return true;
+ if (targetAnimation && targetAnimation->Running()) return true;
+ for (vector<NumberAnimation>::const_iterator i(numberAnimation.begin()), end(numberAnimation.end()); i != end; ++i) {
+ if (i->Running()) return true;
+ }
+ return false;
+}
+
+void PerformAttacks::ResetAnimation() {
+ if (moveAnimation) {
+ moveAnimation->Stop();
+ moveAnimation = 0;
+ }
+ if (targetAnimation) {
+ targetAnimation->Stop();
+ targetAnimation = 0;