+ m.SetName(GetString(*i->second));
+ } else if (i->first == "sprite") {
+ m.SetSprite(GetSprite(*i->second));
+ } else if (i->first == "level") {
+ m.SetLevel(GetNumber(*i->second));
+ } else if (i->first == "maxHealth") {
+ m.SetMaxHealth(GetNumber(*i->second));
+ } else if (i->first == "health") {
+ m.SetHealth(GetNumber(*i->second));
+ } else if (i->first == "maxMana") {
+ m.SetMaxMana(GetNumber(*i->second));
+ } else if (i->first == "mana") {
+ m.SetMana(GetNumber(*i->second));
+ } else if (i->first == "stats") {
+ battle::Stats stats;
+ ReadStats(stats, *GetPropertyList(*i->second));
+ m.SetStats(stats);
+ } else if (i->first == "attackAnimation") {
+ m.SetAttackAnimation(GetAnimation(*i->second));
+ } else if (i->first == "meleeAnimation") {
+ m.SetMeleeAnimation(GetAnimation(*i->second));
+ } else {
+ throw Error("unknown Monster property: " + i->first);
+ }
+ }
+}
+
+void Interpreter::ReadPartyLayout(PartyLayout &p, const PropertyList &props) {
+ for (PropertyList::ConstIterator i(props.Begin()), end(props.End()); i != end; ++i) {
+ if (i->first == "positions") {
+ const vector<Value *> &positions(GetValueArray(*i->second));
+ for (vector<Value *>::const_iterator j(positions.begin()), end(positions.end()); j != end; ++j) {
+ p.AddPosition(GetVector(**j));
+ }
+ } else {
+ throw Error("unknown PartyLayout property: " + i->first);
+ }
+ }
+}
+
+void Interpreter::ReadSimpleAnimation(SimpleAnimation &a, const PropertyList &props) {
+ for (PropertyList::ConstIterator i(props.Begin()), end(props.End()); i != end; ++i) {
+ if (i->first == "sprite") {
+ a.SetSprite(GetSprite(*i->second));
+ } else if (i->first == "frametime") {
+ a.SetFrameTime(GetNumber(*i->second));
+ } else if (i->first == "repeat") {
+ a.SetRepeat(GetBoolean(*i->second));
+ } else if (i->first == "framecount") {
+ a.SetNumFrames(GetNumber(*i->second));
+ } else if (i->first == "col") {
+ a.SetCol(GetNumber(*i->second));
+ } else if (i->first == "row") {
+ a.SetRow(GetNumber(*i->second));
+ } else {
+ throw Error("unknown SimpleAnimation property: " + i->first);
+ }
+ }
+}
+
+void Interpreter::ReadSpell(Spell &s, const PropertyList &props) {
+ for (PropertyList::ConstIterator i(props.Begin()), end(props.End()); i != end; ++i) {
+ if (i->first == "name") {
+ s.SetName(GetString(*i->second));
+ } else if (i->first == "cost") {
+ s.SetCost(GetNumber(*i->second));
+ } else if (i->first == "battle") {
+ if (GetBoolean(*i->second)) {
+ s.SetUsableInBattle();
+ }
+ } else if (i->first == "targets") {
+ s.GetTargetingMode() = *GetTargetingMode(*i->second);
+ } else {
+ throw Error("unknown Spell property: " + i->first);
+ }
+ }
+}
+
+void Interpreter::ReadSprite(Sprite &s, const PropertyList &props) {
+ for (PropertyList::ConstIterator i(props.Begin()), end(props.End()); i != end; ++i) {
+ if (i->first == "image") {
+ s.SetSurface(GetImage(*i->second));
+ } else if (i->first == "size") {
+ s.SetSize(GetVector(*i->second));
+ } else if (i->first == "offset") {
+ s.SetOffset(GetVector(*i->second));
+ } else {
+ throw Error("unknown Sprite property: " + i->first);
+ }
+ }
+}
+
+void Interpreter::ReadStats(Stats &s, const PropertyList &props) {
+ for (PropertyList::ConstIterator i(props.Begin()), end(props.End()); i != end; ++i) {
+ if (i->first == "atp") {
+ s.SetAttack(GetNumber(*i->second));
+ } else if (i->first == "dfp") {
+ s.SetDefense(GetNumber(*i->second));
+ } else if (i->first == "str") {
+ s.SetStrength(GetNumber(*i->second));
+ } else if (i->first == "agl") {
+ s.SetAgility(GetNumber(*i->second));
+ } else if (i->first == "int") {
+ s.SetIntelligence(GetNumber(*i->second));
+ } else if (i->first == "gut") {
+ s.SetGut(GetNumber(*i->second));
+ } else if (i->first == "mgr") {
+ s.SetMagicResistance(GetNumber(*i->second));
+ } else {
+ throw Error("unknown Stats property: " + i->first);
+ }
+ }
+}
+
+void Interpreter::ReadTargetingMode(TargetingMode &t, const PropertyList &props) {
+ for (PropertyList::ConstIterator i(props.Begin()), end(props.End()); i != end; ++i) {
+ if (i->first == "ally") {
+ if (GetBoolean(*i->second)) {
+ t.TargetAlly();
+ } else {
+ t.TargetEnemy();
+ }
+ } else if (i->first == "enemy") {
+ if (GetBoolean(*i->second)) {
+ t.TargetEnemy();