-/*
- * PerformAttacks.cpp
- *
- * Created on: Aug 10, 2012
- * Author: holy
- */
-
#include "PerformAttacks.h"
#include "../BattleState.h"
#include "../Hero.h"
#include "../Monster.h"
+#include "../TargetSelection.h"
#include "../../app/Application.h"
#include "../../app/Input.h"
#include "../../common/Ikari.h"
using app::Application;
using app::Input;
-using geometry::Vector;
+using math::Vector;
using graphics::AnimationRunner;
using std::vector;
battle->CalculateDamage();
- if (battle->CurrentAttack().isMonster) {
+ if (battle->CurrentAttack().IsMonster()) {
Monster &monster(battle->MonsterAt(battle->CurrentAttack().index));
titleBarText = monster.Name();
targetAnimation = AnimationRunner(monster.MeleeAnimation());
moveAnimation = AnimationRunner(monster.AttackAnimation());
monster.SetAnimation(moveAnimation);
AddNumberAnimations(battle->MonsterAt(battle->CurrentAttack().index).GetAttackChoice().Selection());
+ } else if (battle->CurrentAttack().IsCapsule()) {
+ Capsule &capsule(battle->GetCapsule());
+ titleBarText = capsule.Name();
+ targetAnimation = AnimationRunner(capsule.MeleeAnimation());
+ moveAnimation = AnimationRunner(capsule.AttackAnimation());
+ capsule.SetAnimation(moveAnimation);
+ AddNumberAnimations(capsule.GetAttackChoice().Selection());
} else {
Hero &hero(battle->HeroAt(battle->CurrentAttack().index));
const AttackChoice &ac(battle->HeroAt(battle->CurrentAttack().index).GetAttackChoice());
if (titleBarText) titleBarTimer = GraphicsTimers().StartCountdown(850);
if (moveAnimation.Valid()) {
moveAnimation.Start(*this);
- if (battle->CurrentAttack().isMonster) {
+ if (battle->CurrentAttack().IsMonster()) {
battle->MonsterAt(battle->CurrentAttack().index).SetAnimation(moveAnimation);
- } else {
+ } else if (battle->CurrentAttack().IsHero()) {
battle->HeroAt(battle->CurrentAttack().index).SetAnimation(moveAnimation);
+ } else {
+ battle->GetCapsule().SetAnimation(moveAnimation);
}
}
if (targetAnimation.Valid()) {
void PerformAttacks::ResetAnimation() {
if (moveAnimation.Valid()) {
moveAnimation.Clear();
- if (!battle->CurrentAttack().isMonster) {
+ if (!battle->CurrentAttack().IsMonster()) {
battle->HeroAt(battle->CurrentAttack().index).GetAnimation().Clear();
}
}
}
-void PerformAttacks::UpdateWorld(float deltaT) {
+void PerformAttacks::UpdateWorld(Uint32 deltaT) {
}
battle->RenderBackground(screen, offset);
battle->RenderMonsters(screen, offset);
battle->RenderHeroes(screen, offset);
+ battle->RenderCapsule(screen, offset);
battle->RenderSmallHeroTags(screen, offset);
RenderTitleBar(screen, offset);
RenderNumbers(screen, offset);
}
}
-void PerformAttacks::RenderTargetAnimation(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
+void PerformAttacks::RenderTargetAnimation(SDL_Surface *screen, const math::Vector<int> &offset) const {
if (!targetAnimation.Valid() || !targetAnimation.Running()) return;
const TargetSelection &ts(battle->CurrentAttackAttackChoice().Selection());
if (ts.TargetsHeroes()) {