+ if (targetAnimation) {
+ targetAnimationTimer = GraphicsTimers().StartCountdown(150);
+ } else {
+ targetAnimationTimer.Clear();
+ }
+}
+
+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;
+ }
+ titleBarTimer.Clear();
+ numberAnimation.clear();
+ numberPosition.clear();
+}
+
+void PerformAttacks::AdvanceCursor() {
+ ++cursor;
+ while (cursor < int(order.size())) {
+ if (order[cursor].isMonster) {
+ if (battle->MonsterAt(order[cursor].index).Health() > 0) break;
+ } else {
+ if (battle->HeroAt(order[cursor].index).Health() > 0) break;
+ }
+ ++cursor;
+ }