#include "../app/Input.h"
#include "../common/Inventory.h"
#include "../common/Item.h"
+#include "../common/Spell.h"
#include "../geometry/operators.h"
#include "../graphics/Sprite.h"
using app::Input;
using common::Inventory;
using common::Item;
+using common::Spell;
using geometry::Point;
using geometry::Vector;
using graphics::Menu;
heroesLayout->CalculatePositions(background->w, background->h, heroesPositions);
for (vector<Hero>::size_type i(0), end(heroes.size()); i < end; ++i) {
spellMenus.push_back(res->spellMenuPrototype);
- // TODO: insert spell menu entries
+ LoadSpellMenu(i);
ikariMenus.push_back(res->ikariMenuPrototype);
// TODO: insert ikari menu entries
heroTags[i] = HeroTag(&heroes[i], attackChoices + i, res, HeroTag::Alignment((i + 1) % 2));
LoadInventory();
}
+void BattleState::LoadSpellMenu(vector<Hero>::size_type index) {
+ spellMenus[index].Clear();
+ spellMenus[index].Reserve(HeroAt(index).Spells().size());
+ for (vector<const Spell *>::const_iterator i(HeroAt(index).Spells().begin()), end(HeroAt(index).Spells().end()); i != end; ++i) {
+ bool enabled((*i)->CanUseInBattle() && (*i)->Cost() <= HeroAt(index).Mana());
+ spellMenus[index].Add((*i)->Name(), *i, enabled, 0, (*i)->Cost());
+ }
+}
+
void BattleState::LoadInventory() {
const Inventory &inv(*res->inventory);
itemMenu.Clear();