4 * Created on: Aug 1, 2012
8 #include "app/Application.h"
10 #include "battle/AttackAnimation.h"
11 #include "battle/BattleState.h"
12 #include "battle/Hero.h"
13 #include "battle/Monster.h"
14 #include "battle/PartyLayout.h"
15 #include "battle/Resources.h"
16 #include "common/Ikari.h"
17 #include "common/Inventory.h"
18 #include "common/Item.h"
19 #include "common/Spell.h"
20 #include "geometry/Point.h"
21 #include "geometry/Vector.h"
22 #include "graphics/ComplexAnimation.h"
23 #include "graphics/Font.h"
24 #include "graphics/Frame.h"
25 #include "graphics/Gauge.h"
26 #include "graphics/Menu.h"
27 #include "graphics/SimpleAnimation.h"
28 #include "graphics/Sprite.h"
29 #include "sdl/InitImage.h"
30 #include "sdl/InitScreen.h"
31 #include "sdl/InitSDL.h"
36 #include <SDL_image.h>
38 using app::Application;
40 using battle::AttackAnimation;
41 using battle::BattleState;
43 using battle::Monster;
44 using battle::PartyLayout;
46 using common::Inventory;
49 using geometry::Point;
50 using geometry::Vector;
51 using graphics::ComplexAnimation;
53 using graphics::Frame;
54 using graphics::Gauge;
56 using graphics::SimpleAnimation;
57 using graphics::Sprite;
59 using sdl::InitScreen;
67 int main(int argc, char **argv) {
68 const int width = 800;
69 const int height = 480;
73 InitImage image(IMG_INIT_PNG);
74 InitScreen screen(width, height);
76 // temporary test data
77 SDL_Surface *bg(IMG_Load("test-data/battle-bg.png"));
78 PartyLayout monstersLayout;
79 monstersLayout.AddPosition(Point<Uint8>(88, 104));
80 monstersLayout.AddPosition(Point<Uint8>(128, 104));
81 monstersLayout.AddPosition(Point<Uint8>(168, 104));
82 monstersLayout.AddPosition(Point<Uint8>(208, 104));
83 PartyLayout heroesLayout;
84 heroesLayout.AddPosition(Point<Uint8>(48, 152));
85 heroesLayout.AddPosition(Point<Uint8>(128, 152));
86 heroesLayout.AddPosition(Point<Uint8>(80, 168));
87 heroesLayout.AddPosition(Point<Uint8>(160, 168));
89 SDL_Surface *monsterImg(IMG_Load("test-data/monster.png"));
90 Sprite dummySprite(monsterImg, 64, 64);
92 monster.SetName("Monster");
93 monster.SetSprite(&dummySprite);
94 monster.SetMaxHealth(10);
95 monster.SetHealth(10);
97 SDL_Surface *maximImg(IMG_Load("test-data/maxim.png"));
98 Sprite maximSprite(maximImg, 64, 64);
100 maxim.SetName("Maxim");
102 maxim.SetSprite(&maximSprite);
103 maxim.SetMaxHealth(33);
105 maxim.SetMaxMana(20);
108 ComplexAnimation maximAttackAnimation(&maximSprite, 30);
109 maximAttackAnimation.AddFrame(1, 0, Vector<int>(2, 0));
110 maximAttackAnimation.AddFrame(1, 0, Vector<int>(2, -1));
111 maximAttackAnimation.AddFrames(2, 0, Vector<int>(2, -2), 2);
112 maximAttackAnimation.AddFrame(2, 0, Vector<int>(4, -2));
113 maximAttackAnimation.AddFrame(2, 0, Vector<int>(3, -1));
114 maximAttackAnimation.AddFrames(2, 1, Vector<int>(3, -1), 2);
115 maximAttackAnimation.AddFrame(2, 1);
116 maximAttackAnimation.AddFrames(2, 2, Vector<int>(), 2);
117 maxim.SetAttackAnimation(&maximAttackAnimation);
118 ComplexAnimation maximSpellAnimation(&maximSprite, 150);
119 maximSpellAnimation.AddFrames(3, 0, Vector<int>(), 2);
120 maximSpellAnimation.AddFrame(3, 1);
121 maxim.SetSpellAnimation(&maximSpellAnimation);
122 SDL_Surface *maximMeleeImg(IMG_Load("test-data/melee-maxim.png"));
123 Sprite maximMeleeSprite(maximMeleeImg, 96, 96);
124 SimpleAnimation maximMeleeAnimation(&maximMeleeSprite, 30, 4);
125 AttackAnimation maximMeleeScript;
126 maximMeleeScript.PlayAttackAnimation();
127 maximMeleeScript.StartTimer(150);
128 maximMeleeScript.WaitForTimer();
129 maximMeleeScript.PlayTargetAnimation(&maximMeleeAnimation);
130 maximMeleeScript.WaitForAnimations();
131 maxim.SetMeleeAnimation(&maximMeleeScript);
133 SDL_Surface *selanImg(IMG_Load("test-data/selan.png"));
134 Sprite selanSprite(selanImg, 64, 64);
136 selan.SetName("Selan");
138 selan.SetSprite(&selanSprite);
139 selan.SetMaxHealth(28);
141 selan.SetMaxMana(23);
144 ComplexAnimation selanAttackAnimation(&selanSprite, 30);
145 selanAttackAnimation.AddFrames(1, 0, Vector<int>(4, 0), 2);
146 selanAttackAnimation.AddFrame(1, 0, Vector<int>(8, 2));
147 selanAttackAnimation.AddFrame(2, 0, Vector<int>(10, 4));
148 selanAttackAnimation.AddFrame(2, 0, Vector<int>(14, 4));
149 selanAttackAnimation.AddFrames(2, 0, Vector<int>(12, 2), 3);
150 selanAttackAnimation.AddFrames(2, 1, Vector<int>(14, 2), 2);
151 selanAttackAnimation.AddFrame(2, 1, Vector<int>(2, 0));
152 selanAttackAnimation.AddFrame(2, 2, Vector<int>(-2, -4));
153 selanAttackAnimation.AddFrame(2, 2, Vector<int>(-8, -8));
154 selanAttackAnimation.AddFrame(2, 2);
155 selan.SetAttackAnimation(&selanAttackAnimation);
156 ComplexAnimation selanSpellAnimation(&selanSprite, 30);
157 selanSpellAnimation.AddFrames(2, 0, Vector<int>(), 3);
158 selanSpellAnimation.AddFrames(2, 1, Vector<int>(), 2);
159 selanSpellAnimation.AddFrames(2, 2, Vector<int>(), 3);
160 selanSpellAnimation.AddFrames(2, 3, Vector<int>(), 2);
161 selan.SetSpellAnimation(&selanSpellAnimation);
163 SDL_Surface *guyImg(IMG_Load("test-data/guy.png"));
164 Sprite guySprite(guyImg, 64, 64);
168 guy.SetSprite(&guySprite);
169 guy.SetMaxHealth(38);
174 ComplexAnimation guyAttackAnimation(&guySprite, 30);
175 guyAttackAnimation.AddFrames(1, 0, Vector<int>(-4, 0), 2);
176 guyAttackAnimation.AddFrames(1, 0, Vector<int>(-8, 0), 2);
177 guyAttackAnimation.AddFrames(2, 0, Vector<int>(-8, 0), 2);
178 guyAttackAnimation.AddFrame(2, 0, Vector<int>(-4, 0));
179 guyAttackAnimation.AddFrames(2, 0, Vector<int>(), 2);
180 guyAttackAnimation.AddFrame(2, 1);
181 guyAttackAnimation.AddFrame(2, 1, Vector<int>(4, 0));
182 guyAttackAnimation.AddFrame(2, 1, Vector<int>(10, 0));
183 guyAttackAnimation.AddFrame(2, 2, Vector<int>(10, 0));
184 guyAttackAnimation.AddFrame(2, 2);
185 guy.SetAttackAnimation(&guyAttackAnimation);
187 SDL_Surface *dekarImg(IMG_Load("test-data/dekar.png"));
188 Sprite dekarSprite(dekarImg, 64, 64);
190 dekar.SetName("Dekar");
192 dekar.SetSprite(&dekarSprite);
193 dekar.SetMaxHealth(38);
198 ComplexAnimation dekarAttackAnimation(&dekarSprite, 30);
199 dekarAttackAnimation.AddFrame(1, 0, Vector<int>(4, 0));
200 dekarAttackAnimation.AddFrame(1, 0, Vector<int>(8, 2));
201 dekarAttackAnimation.AddFrame(2, 0, Vector<int>(12, 4));
202 dekarAttackAnimation.AddFrame(2, 0, Vector<int>(16, 4));
203 dekarAttackAnimation.AddFrames(2, 0, Vector<int>(10, 2), 4);
204 dekarAttackAnimation.AddFrame(2, 1, Vector<int>(6, 2));
205 dekarAttackAnimation.AddFrame(2, 1, Vector<int>());
206 dekarAttackAnimation.AddFrame(2, 2, Vector<int>(-2, 0));
207 dekarAttackAnimation.AddFrames(2, 2, Vector<int>(0, 0), 3);
208 dekar.SetAttackAnimation(&dekarAttackAnimation);
209 ComplexAnimation dekarSpellAnimation(&dekarSprite, 30);
210 dekarSpellAnimation.AddFrames(2, 0, Vector<int>(), 6);
211 dekarSpellAnimation.AddFrames(2, 1, Vector<int>(), 2);
212 dekarSpellAnimation.AddFrames(2, 2, Vector<int>(), 3);
213 dekar.SetSpellAnimation(&dekarSpellAnimation);
215 battle::Resources battleRes;
217 SDL_Surface *swapCursorImg(IMG_Load("test-data/swap-cursor.png"));
218 Sprite swapCursorSprite(swapCursorImg, 32, 32);
219 battleRes.swapCursor = &swapCursorSprite;
220 SDL_Surface *attackIconsImg(IMG_Load("test-data/attack-type-icons.png"));
221 Sprite attackIconsSprite(attackIconsImg, 32, 32);
222 battleRes.attackIcons = &attackIconsSprite;
223 SDL_Surface *attackChoiceIconsImg(IMG_Load("test-data/attack-choice-icons.png"));
224 Sprite attackChoiceIconsSprite(attackChoiceIconsImg, 16, 16);
225 battleRes.attackChoiceIcons = &attackChoiceIconsSprite;
226 SDL_Surface *moveIconsImg(IMG_Load("test-data/move-icons.png"));
227 Sprite moveIconsSprite(moveIconsImg, 32, 32);
228 battleRes.moveIcons = &moveIconsSprite;
230 SDL_Surface *titleFrameImg(IMG_Load("test-data/title-frame.png"));
231 Frame titleFrame(titleFrameImg, 16, 16);
232 battleRes.titleFrame = &titleFrame;
234 SDL_Surface *largeFontImg(IMG_Load("test-data/large-font.png"));
235 Sprite largeFontSprite(largeFontImg, 16, 32);
236 Font largeFont(&largeFontSprite, 0, -2);
237 battleRes.titleFont = &largeFont;
239 battleRes.numberAnimationPrototype = ComplexAnimation(0, 30);
240 battleRes.numberAnimationPrototype.AddFrame(0, 0);
241 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -26));
242 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -42));
243 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -48));
244 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -42));
245 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -26));
246 battleRes.numberAnimationPrototype.AddFrame(0, 0);
247 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
248 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -20));
249 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -24));
250 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -20));
251 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
252 battleRes.numberAnimationPrototype.AddFrame(0, 0);
253 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -6));
254 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -10));
255 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
256 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -10));
257 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -6));
258 battleRes.numberAnimationPrototype.AddFrames(0, 0, Vector<int>(), 14);
259 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -36));
260 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -32));
261 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -18));
263 SDL_Surface *bigNumbersImg(IMG_Load("test-data/big-numbers.png"));
264 Sprite bigNumbersSprite(bigNumbersImg, 16, 32);
265 battleRes.bigNumberSprite = &bigNumbersSprite;
266 SDL_Surface *bigGreenNumbersImg(IMG_Load("test-data/big-green-numbers.png"));
267 Sprite bigGreenNumbersSprite(bigGreenNumbersImg, 16, 32);
268 battleRes.greenNumberSprite = &bigGreenNumbersSprite;
270 SDL_Surface *heroTagImg(IMG_Load("test-data/hero-tag-sprites.png"));
271 Sprite heroTagSprite(heroTagImg, 32, 16);
272 battleRes.heroTagLabels = &heroTagSprite;
273 battleRes.levelLabelCol = 0;
274 battleRes.levelLabelRow = 0;
275 battleRes.healthLabelCol = 0;
276 battleRes.healthLabelRow = 1;
277 battleRes.manaLabelCol = 0;
278 battleRes.manaLabelRow = 2;
279 battleRes.moveLabelCol = 0;
280 battleRes.moveLabelRow = 3;
281 battleRes.ikariLabelCol = 0;
282 battleRes.ikariLabelRow = 4;
284 SDL_Surface *numbersImg(IMG_Load("test-data/numbers.png"));
285 Sprite numbersSprite(numbersImg, 16, 16);
286 Font heroTagFont(&numbersSprite, 0, -3);
287 battleRes.heroTagFont = &heroTagFont;
288 SDL_Surface *tagFramesImg(IMG_Load("test-data/tag-frames.png"));
289 Frame heroTagFrame(tagFramesImg, 16, 16, 1, 1, 0, 33);
290 battleRes.heroTagFrame = &heroTagFrame;
291 Frame activeHeroTagFrame(tagFramesImg, 16, 16);
292 battleRes.activeHeroTagFrame = &activeHeroTagFrame;
293 SDL_Surface *smallTagFrameImg(IMG_Load("test-data/small-tag-frame.png"));
294 Frame smallTagFrame(smallTagFrameImg, 8, 16);
295 battleRes.smallHeroTagFrame = &smallTagFrame;
296 Frame lastSmallTagFrame(smallTagFrameImg, 8, 16, 1, 1, 0, 33);
297 battleRes.lastSmallHeroTagFrame = &lastSmallTagFrame;
298 battleRes.heroesBgColor = SDL_MapRGB(screen.Screen()->format, 0x18, 0x28, 0x31);
300 SDL_Surface *gauges(IMG_Load("test-data/gauges.png"));
301 Gauge healthGauge(gauges, 0, 16, 0, 0, 16, 6, 1, 6);
302 battleRes.healthGauge = &healthGauge;
303 Gauge manaGauge(gauges, 0, 32, 0, 0, 16, 6, 1, 6);
304 battleRes.manaGauge = &manaGauge;
305 Gauge ikariGauge(gauges, 0, 48, 0, 0, 16, 6, 1, 6);
306 battleRes.ikariGauge = &ikariGauge;
308 SDL_Surface *selectFrameImg(IMG_Load("test-data/select-frame.png"));
309 Frame selectFrame(selectFrameImg, 16, 16);
310 battleRes.selectFrame = &selectFrame;
312 SDL_Surface *normalFontImg(IMG_Load("test-data/normal-font.png"));
313 Sprite normalFontSprite(normalFontImg, 16, 16);
314 Font normalFont(&normalFontSprite, 0, -2);
315 battleRes.normalFont = &normalFont;
317 SDL_Surface *disabledFontImg(IMG_Load("test-data/disabled-font.png"));
318 Sprite disabledFontSprite(disabledFontImg, 16, 16);
319 Font disabledFont(&disabledFontSprite, 0, -2);
320 battleRes.disabledFont = &disabledFont;
322 SDL_Surface *handCursorImg(IMG_Load("test-data/cursor-hand.png"));
323 Sprite handCursorSprite(handCursorImg, 32, 32);
324 battleRes.menuCursor = &handCursorSprite;
326 SDL_Surface *targetingIconsImg(IMG_Load("test-data/targeting-icons.png"));
327 Sprite weaponTargetCursor(targetingIconsImg, 32, 32);
328 Sprite magicTargetCursor(targetingIconsImg, 32, 32, 0, 32);
329 Sprite itemTargetCursor(targetingIconsImg, 32, 32, 0, 64);
330 battleRes.weaponTargetCursor = &weaponTargetCursor;
331 // TODO: add image for magic targeting cursor
332 battleRes.magicTargetCursor = &magicTargetCursor;
333 // TODO: add image for item targeting cursor
334 battleRes.itemTargetCursor = &itemTargetCursor;
337 resetSpell.SetName("Reset");
338 maxim.AddSpell(&resetSpell);
340 strongSpell.SetName("Strong");
341 strongSpell.SetCost(3);
342 strongSpell.SetUsableInBattle();
343 strongSpell.GetTargetingMode().TargetMultipleAllies();
344 maxim.AddSpell(&strongSpell);
345 selan.AddSpell(&strongSpell);
347 strongerSpell.SetName("Stronger");
348 strongerSpell.SetCost(8);
349 strongerSpell.SetUsableInBattle();
350 strongerSpell.GetTargetingMode().TargetMultipleAllies();
351 maxim.AddSpell(&strongerSpell);
352 selan.AddSpell(&strongerSpell);
354 championSpell.SetName("Champion");
355 championSpell.SetCost(16);
356 championSpell.SetUsableInBattle();
357 championSpell.GetTargetingMode().TargetMultipleAllies();
358 maxim.AddSpell(&championSpell);
359 selan.AddSpell(&championSpell);
361 rallySpell.SetName("Rally");
362 rallySpell.SetCost(10);
363 rallySpell.SetUsableInBattle();
364 rallySpell.GetTargetingMode().TargetMultipleAllies();
365 maxim.AddSpell(&rallySpell);
366 selan.AddSpell(&rallySpell);
368 escapeSpell.SetName("Escape");
369 escapeSpell.SetCost(8);
370 selan.AddSpell(&escapeSpell);
372 valorSpell.SetName("Valor");
373 valorSpell.SetCost(30);
374 valorSpell.SetUsableInBattle();
375 valorSpell.GetTargetingMode().TargetMultipleAllies();
376 maxim.AddSpell(&valorSpell);
377 selan.AddSpell(&valorSpell);
379 battleRes.spellMenuHeadline = "Please choose a spell.";
380 battleRes.spellMenuPrototype = Menu<const Spell *>(&normalFont, &disabledFont, &handCursorSprite, 9, 6, 8, 0, 2, 32, 2, ':');
382 SDL_Surface *itemIcons(IMG_Load("test-data/item-icons.png"));
383 Sprite potionIcon(itemIcons, 16, 16);
384 Sprite ballIcon(itemIcons, 16, 16, 0, 16);
385 Sprite crankIcon(itemIcons, 16, 16, 0, 32);
386 Sprite spearIcon(itemIcons, 16, 16, 0, 48);
387 Sprite swordIcon(itemIcons, 16, 16, 0, 64);
388 Sprite axIcon(itemIcons, 16, 16, 0, 80);
389 Sprite rodIcon(itemIcons, 16, 16, 0, 96);
390 Sprite armorIcon(itemIcons, 16, 16, 0, 112);
391 Sprite shieldIcon(itemIcons, 16, 16, 0, 128);
392 Sprite helmetIcon(itemIcons, 16, 16, 0, 144);
393 Sprite ringIcon(itemIcons, 16, 16, 0, 160);
394 Sprite jewelIcon(itemIcons, 16, 16, 0, 176);
396 battleRes.weaponMenuIcon = &swordIcon;
397 battleRes.armorMenuIcon = &armorIcon;
398 battleRes.shieldMenuIcon = &shieldIcon;
399 battleRes.helmetMenuIcon = &helmetIcon;
400 battleRes.ringMenuIcon = &ringIcon;
401 battleRes.jewelMenuIcon = &jewelIcon;
405 antidote.SetName("Antidote");
406 antidote.SetMenuIcon(&potionIcon);
407 antidote.SetUsableInBattle();
408 antidote.GetTargetingMode().TargetSingleAlly();
409 inventory.Add(&antidote, 9);
411 magicJar.SetName("Magic jar");
412 magicJar.SetMenuIcon(&potionIcon);
413 magicJar.SetUsableInBattle();
414 magicJar.GetTargetingMode().TargetSingleAlly();
415 inventory.Add(&magicJar, 4);
417 hiPotion.SetName("Hi-Potion");
418 hiPotion.SetMenuIcon(&potionIcon);
419 hiPotion.SetUsableInBattle();
420 hiPotion.GetTargetingMode().TargetSingleAlly();
421 inventory.Add(&hiPotion, 4);
423 powerPotion.SetName("Power potion");
424 powerPotion.SetMenuIcon(&potionIcon);
425 inventory.Add(&powerPotion, 4);
427 escape.SetName("Escape");
428 inventory.Add(&escape, 2);
430 sleepBall.SetName("Sleep ball");
431 sleepBall.SetMenuIcon(&ballIcon);
432 sleepBall.SetUsableInBattle();
433 sleepBall.GetTargetingMode().TargetSingleEnemy();
434 inventory.Add(&sleepBall, 1);
436 multiBall.SetName("Multi-ball!");
437 multiBall.SetMenuIcon(&ballIcon);
438 multiBall.SetUsableInBattle();
439 multiBall.GetTargetingMode().TargetMultipleEnemies();
440 inventory.Add(&multiBall, 1);
442 figgoru.SetName("Figgoru");
443 figgoru.SetMenuIcon(&crankIcon);
444 figgoru.GetTargetingMode().TargetAllEnemies();
445 inventory.Add(&figgoru, 1);
446 battleRes.inventory = &inventory;
448 battleRes.itemMenuHeadline = "Please choose an item.";
449 battleRes.itemMenuPrototype = Menu<const common::Item *>(&normalFont, &disabledFont, &handCursorSprite, 15, 6, 8, 16, 1, 32, 2, ':');
452 zircoSword.SetName("Zirco sword");
453 zircoSword.SetMenuIcon(&swordIcon);
455 firestorm.SetName("Firestorm");
456 firestorm.SetCost(224);
457 firestorm.GetTargetingMode().TargetAllEnemies();
458 firestorm.SetPhysical();
459 zircoSword.SetIkari(&firestorm);
460 // maxim.SetWeapon(&zircoSword);
462 zirconArmor.SetName("Zircon armor");
463 zirconArmor.SetMenuIcon(&armorIcon);
465 magicCure.SetName("Magic cure");
466 magicCure.SetCost(128);
467 magicCure.GetTargetingMode().TargetSingleAlly();
468 magicCure.SetMagical();
469 zirconArmor.SetIkari(&magicCure);
470 maxim.SetArmor(&zirconArmor);
472 holyShield.SetName("Holy shield");
473 holyShield.SetMenuIcon(&shieldIcon);
475 lightGuard.SetName("Light guard");
476 lightGuard.SetCost(128);
477 lightGuard.GetTargetingMode().TargetAllAllies(); // FIXME: actually only targets self
478 lightGuard.SetMagical();
479 holyShield.SetIkari(&lightGuard);
480 maxim.SetShield(&holyShield);
482 legendHelm.SetName("Legend helm");
483 legendHelm.SetMenuIcon(&helmetIcon);
485 boomerang.SetName("Boomerang");
486 boomerang.SetCost(164);
487 boomerang.GetTargetingMode().TargetAllAllies(); // FIXME: actually only targets self
488 boomerang.SetMagical();
489 legendHelm.SetIkari(&boomerang);
490 maxim.SetHelmet(&legendHelm);
492 sProRing.SetName("S-pro ring");
493 sProRing.SetMenuIcon(&ringIcon);
495 courage.SetName("Courage");
497 courage.GetTargetingMode().TargetMultipleAllies();
498 courage.SetMagical();
499 sProRing.SetIkari(&courage);
500 maxim.SetRing(&sProRing);
502 evilJewel.SetName("Evil jewel");
503 evilJewel.SetMenuIcon(&jewelIcon);
505 gloomy.SetName("Gloomy");
507 gloomy.GetTargetingMode().TargetAllEnemies();
509 evilJewel.SetIkari(&gloomy);
510 maxim.SetJewel(&evilJewel);
513 zircoWhip.SetName("Zirco whip");
514 zircoWhip.SetMenuIcon(&rodIcon);
516 thundershriek.SetName("Thundershriek");
517 thundershriek.SetCost(224);
518 thundershriek.GetTargetingMode().TargetAllEnemies();
519 thundershriek.SetPhysical();
520 zircoWhip.SetIkari(&thundershriek);
521 selan.SetWeapon(&zircoWhip);
523 zirconPlate.SetName("Zircon plate");
524 zirconPlate.SetMenuIcon(&armorIcon);
526 suddenCure.SetName("Sudden cure");
527 suddenCure.SetCost(96);
528 suddenCure.GetTargetingMode().TargetAllAllies();
529 suddenCure.SetMagical();
530 zirconPlate.SetIkari(&suddenCure);
531 selan.SetArmor(&zirconPlate);
533 zircoGloves.SetName("Zirco gloves");
534 zircoGloves.SetMenuIcon(&shieldIcon);
536 forcefield.SetName("Forcefield");
537 forcefield.SetCost(64);
538 forcefield.GetTargetingMode().TargetAllAllies();
539 forcefield.SetMagical();
540 zircoGloves.SetIkari(&forcefield);
541 selan.SetShield(&zircoGloves);
543 holyCap.SetName("Holy cap");
544 holyCap.SetMenuIcon(&helmetIcon);
546 vulnerable.SetName("Vulnerable");
547 vulnerable.SetCost(196);
548 vulnerable.GetTargetingMode().TargetAllEnemies();
549 vulnerable.SetPhysical();
550 holyCap.SetIkari(&vulnerable);
551 selan.SetHelmet(&holyCap);
553 ghostRing.SetName("Ghost ring");
554 ghostRing.SetMenuIcon(&ringIcon);
556 destroy.SetName("Destroy");
557 destroy.SetCost(128);
558 destroy.GetTargetingMode().TargetMultipleEnemies();
559 destroy.SetMagical();
560 ghostRing.SetIkari(&destroy);
561 selan.SetRing(&ghostRing);
563 eagleRock.SetName("Eagle rock");
564 eagleRock.SetMenuIcon(&jewelIcon);
566 dive.SetName("Dive");
568 dive.GetTargetingMode().TargetSingleEnemy();
570 eagleRock.SetIkari(&dive);
571 selan.SetJewel(&eagleRock);
574 zircoAx.SetName("Zirco ax");
575 zircoAx.SetMenuIcon(&axIcon);
577 torrent.SetName("Torrent");
578 torrent.SetCost(224);
579 torrent.GetTargetingMode().TargetAllEnemies();
580 torrent.SetPhysical();
581 zircoAx.SetIkari(&torrent);
582 guy.SetWeapon(&zircoAx);
583 guy.SetArmor(&zirconArmor);
585 megaShield.SetName("Mega shield");
586 megaShield.SetMenuIcon(&shieldIcon);
588 ironBarrier.SetName("Iron barrier");
589 ironBarrier.SetCost(255);
590 ironBarrier.GetTargetingMode().TargetAllAllies(); // FIXME: actually only targets self
591 ironBarrier.SetMagical();
592 megaShield.SetIkari(&ironBarrier);
593 guy.SetShield(&megaShield);
595 zircoHelmet.SetName("Zirco helmet");
596 zircoHelmet.SetMenuIcon(&helmetIcon);
598 slow.SetName("Slow");
600 slow.GetTargetingMode().TargetAllEnemies();
602 zircoHelmet.SetIkari(&slow);
603 guy.SetHelmet(&zircoHelmet);
605 powerRing.SetName("Power ring");
606 powerRing.SetMenuIcon(&ringIcon);
608 trick.SetName("Trick");
610 trick.GetTargetingMode().TargetAllEnemies();
612 zircoHelmet.SetIkari(&trick);
613 guy.SetRing(&powerRing);
614 guy.SetJewel(&evilJewel);
616 // NOTE: this is actually Artea equipment
618 lizardBlow.SetName("Lizard blow");
619 lizardBlow.SetMenuIcon(&swordIcon);
621 dragonRush.SetName("Dragon rush");
622 dragonRush.SetCost(164);
623 dragonRush.GetTargetingMode().TargetSingleEnemy();
624 dragonRush.SetPhysical();
625 lizardBlow.SetIkari(&dragonRush);
626 dekar.SetWeapon(&lizardBlow);
628 holyRobe.SetName("Holy robe");
629 holyRobe.SetMenuIcon(&armorIcon);
631 crisisCure.SetName("Crisis cure");
632 crisisCure.SetCost(164);
633 crisisCure.GetTargetingMode().TargetAllAllies();
634 crisisCure.SetMagical();
635 holyRobe.SetIkari(&crisisCure);
636 dekar.SetArmor(&holyRobe);
637 dekar.SetShield(&zircoGloves);
638 dekar.SetHelmet(&holyCap);
640 rocketRing.SetName("Rocket ring");
641 rocketRing.SetMenuIcon(&ringIcon);
643 fake.SetName("Fake");
645 fake.GetTargetingMode().TargetSingleAlly();
647 rocketRing.SetIkari(&fake);
648 dekar.SetRing(&rocketRing);
650 krakenRock.SetName("Kraken rock");
651 krakenRock.SetMenuIcon(&jewelIcon);
653 tenLegger.SetName("Ten-legger");
654 tenLegger.SetCost(164);
655 tenLegger.GetTargetingMode().TargetAllEnemies();
656 tenLegger.SetPhysical();
657 rocketRing.SetIkari(&tenLegger);
658 dekar.SetJewel(&krakenRock);
660 battleRes.ikariMenuHeadline = "Please choose equipment.";
661 battleRes.noEquipmentText = "No equip";
662 battleRes.ikariMenuPrototype = Menu<const Item *>(&normalFont, &disabledFont, &handCursorSprite, 12, 6, normalFont.CharHeight() / 2, normalFont.CharWidth(), 1, normalFont.CharWidth() * 2, 0, ':', 12, normalFont.CharWidth());
664 battleRes.escapeText = "Escapes.";
666 BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout, &battleRes));
667 battleState->AddMonster(monster);
668 battleState->AddMonster(monster);
669 battleState->AddMonster(monster);
670 battleState->AddMonster(monster);
671 battleState->AddHero(maxim);
672 battleState->AddHero(selan);
673 battleState->AddHero(guy);
674 battleState->AddHero(dekar);
675 Application app(&screen, battleState);
676 app.Buttons().MapKey(SDLK_w, Input::PAD_UP);
677 app.Buttons().MapKey(SDLK_d, Input::PAD_RIGHT);
678 app.Buttons().MapKey(SDLK_s, Input::PAD_DOWN);
679 app.Buttons().MapKey(SDLK_a, Input::PAD_LEFT);
680 app.Buttons().MapKey(SDLK_RIGHT, Input::ACTION_A);
681 app.Buttons().MapKey(SDLK_DOWN, Input::ACTION_B);
682 app.Buttons().MapKey(SDLK_UP, Input::ACTION_X);
683 app.Buttons().MapKey(SDLK_LEFT, Input::ACTION_Y);
684 app.Buttons().MapKey(SDLK_RETURN, Input::START);
685 app.Buttons().MapKey(SDLK_SPACE, Input::SELECT);
686 app.Buttons().MapKey(SDLK_RSHIFT, Input::SHOULDER_RIGHT);
687 app.Buttons().MapKey(SDLK_LSHIFT, Input::SHOULDER_LEFT);
691 } catch (exception &e) {
692 cerr << "exception in main(): " << e.what() << endl;