#include "../../geometry/Point.h"
#include "../../graphics/Font.h"
#include "../../graphics/Frame.h"
+#include "../../graphics/SimpleAnimation.h"
#include <cstring>
using app::Input;
using geometry::Point;
using geometry::Vector;
+using graphics::SimpleAnimation;
namespace battle {
ctrl->PopState();
}
} else {
+ if (cursor == 0) {
+ battle->HeroAnimationAt(battle->NumHeroes() - 1).Stop();
+ }
titleBarText = battle->MonsterAt(cursor).Name();
}
} else {
+ const AttackChoice &ac(battle->AttackChoiceAt(cursor));
if (titleBarText) {
titleBarText = 0;
+
+ switch (ac.GetType()) {
+ case AttackChoice::SWORD:
+ battle->HeroAnimationAt(cursor) = SimpleAnimation(
+ battle->HeroAt(cursor).Sprite(),
+ battle->HeroAt(cursor).AttackFrameTime(),
+ battle->HeroAt(cursor).AttackFrames(), 2);
+ break;
+ case AttackChoice::MAGIC:
+ battle->HeroAnimationAt(cursor) = SimpleAnimation(
+ battle->HeroAt(cursor).Sprite(),
+ battle->HeroAt(cursor).SpellFrameTime(),
+ battle->HeroAt(cursor).SpellFrames(), 3);
+ break;
+ case AttackChoice::DEFEND:
+ break;
+ case AttackChoice::IKARI:
+ if (ac.GetItem()->HasIkari()) {
+ if (ac.GetItem()->GetIkari()->IsMagical()) {
+ battle->HeroAnimationAt(cursor) = SimpleAnimation(
+ battle->HeroAt(cursor).Sprite(),
+ battle->HeroAt(cursor).SpellFrameTime(),
+ battle->HeroAt(cursor).SpellFrames(), 3);
+ } else {
+ battle->HeroAnimationAt(cursor) = SimpleAnimation(
+ battle->HeroAt(cursor).Sprite(),
+ battle->HeroAt(cursor).AttackFrameTime(),
+ battle->HeroAt(cursor).AttackFrames(), 2);
+ }
+ }
+ break;
+ case AttackChoice::ITEM:
+ break;
+ case AttackChoice::UNDECIDED:
+ break;
+ }
+ battle->HeroAnimationAt(cursor).Start(*this);
+
++cursor;
if (cursor == battle->NumHeroes()) {
cursor = 0;
monsters = true;
}
} else {
- const AttackChoice &ac(battle->AttackChoiceAt(cursor));
+ if (cursor > 0) {
+ battle->HeroAnimationAt(cursor - 1).Stop();
+ }
switch (ac.GetType()) {
case AttackChoice::SWORD:
titleBarText = battle->HeroAt(cursor).HasWeapon() ? battle->HeroAt(cursor).Weapon()->Name() : "Gauntlet";
battle->RenderBackground(screen, offset);
battle->RenderMonsters(screen, offset);
battle->RenderHeroes(screen, offset);
- // render small tags
+ battle->RenderSmallHeroTags(screen, offset);
RenderTitleBar(screen, offset);
}