]> git.localhorst.tv Git - l2e.git/commitdiff
added realistic test data
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 8 Aug 2012 14:52:01 +0000 (16:52 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Wed, 8 Aug 2012 14:52:01 +0000 (16:52 +0200)
src/battle/Hero.h
src/main.cpp
test-data/dekar.png [new file with mode: 0644]
test-data/guy.png [new file with mode: 0644]
test-data/hero.png [deleted file]
test-data/maxim.png [new file with mode: 0644]
test-data/selan.png [new file with mode: 0644]

index d7f6a49d97b0a89efaeffe8c752d46db5484f922..b1982b05285ab7cc2b73f80ee91e208b5f3230b6 100644 (file)
@@ -31,7 +31,7 @@ public:
 
        Uint16 MaxMana() const { return maxMana; }
        Uint16 Mana() const { return mana; }
-       int RelativeMana(int max) const { return mana * max / maxMana; }
+       int RelativeMana(int max) const { return maxMana == 0 ? 0 : mana * max / maxMana; }
 
        Uint8 IP() const { return ip; }
        int RelativeIP(int max) const { return ip * max / 255; }
index 850907f59552e356d1992f67d13f2435f6d1dd08..c8668dca1145f8c3da24bca4d50691be768b9c02 100644 (file)
@@ -72,17 +72,53 @@ int main(int argc, char **argv) {
                Monster monster;
                monster.SetSprite(&dummySprite);
 
-               SDL_Surface *heroImg(IMG_Load("test-data/hero.png"));
-               Sprite heroSprite(heroImg, 64, 64);
-               Hero hero;
-               hero.SetName("Name");
-               hero.SetLevel(34);
-               hero.SetSprite(&heroSprite);
-               hero.SetMaxHealth(100);
-               hero.SetHealth(50);
-               hero.SetMaxMana(100);
-               hero.SetMana(100);
-               hero.SetIP(255);
+               SDL_Surface *maximImg(IMG_Load("test-data/maxim.png"));
+               Sprite maximSprite(maximImg, 64, 64);
+               Hero maxim;
+               maxim.SetName("Maxim");
+               maxim.SetLevel(1);
+               maxim.SetSprite(&maximSprite);
+               maxim.SetMaxHealth(33);
+               maxim.SetHealth(33);
+               maxim.SetMaxMana(20);
+               maxim.SetMana(20);
+               maxim.SetIP(0);
+
+               SDL_Surface *selanImg(IMG_Load("test-data/selan.png"));
+               Sprite selanSprite(selanImg, 64, 64);
+               Hero selan;
+               selan.SetName("Selan");
+               selan.SetLevel(1);
+               selan.SetSprite(&selanSprite);
+               selan.SetMaxHealth(28);
+               selan.SetHealth(28);
+               selan.SetMaxMana(23);
+               selan.SetMana(23);
+               selan.SetIP(0);
+
+               SDL_Surface *guyImg(IMG_Load("test-data/guy.png"));
+               Sprite guySprite(guyImg, 64, 64);
+               Hero guy;
+               guy.SetName("Guy");
+               guy.SetLevel(1);
+               guy.SetSprite(&guySprite);
+               guy.SetMaxHealth(38);
+               guy.SetHealth(38);
+               guy.SetMaxMana(0);
+               guy.SetMana(0);
+               guy.SetIP(0);
+
+               SDL_Surface *dekarImg(IMG_Load("test-data/dekar.png"));
+               Sprite dekarSprite(dekarImg, 64, 64);
+               Hero dekar;
+               dekar.SetName("Dekar");
+               dekar.SetLevel(1);
+               dekar.SetSprite(&dekarSprite);
+               dekar.SetMaxHealth(38);
+               dekar.SetHealth(38);
+               dekar.SetMaxMana(0);
+               dekar.SetMana(0);
+               dekar.SetIP(0);
 
                SDL_Surface *attackIcons(IMG_Load("test-data/attack-type-icons.png"));
                Sprite attackIconsSprite(attackIcons, 32, 32);
@@ -107,10 +143,10 @@ int main(int argc, char **argv) {
                battleState->AddMonster(monster);
                battleState->AddMonster(monster);
                battleState->AddMonster(monster);
-               battleState->AddHero(hero);
-               battleState->AddHero(hero);
-               battleState->AddHero(hero);
-               battleState->AddHero(hero);
+               battleState->AddHero(maxim);
+               battleState->AddHero(selan);
+               battleState->AddHero(guy);
+               battleState->AddHero(dekar);
                Application app(&screen, battleState);
                app.Buttons().MapKey(SDLK_w, Input::PAD_UP);
                app.Buttons().MapKey(SDLK_d, Input::PAD_RIGHT);
diff --git a/test-data/dekar.png b/test-data/dekar.png
new file mode 100644 (file)
index 0000000..f032da1
Binary files /dev/null and b/test-data/dekar.png differ
diff --git a/test-data/guy.png b/test-data/guy.png
new file mode 100644 (file)
index 0000000..0f1c2fe
Binary files /dev/null and b/test-data/guy.png differ
diff --git a/test-data/hero.png b/test-data/hero.png
deleted file mode 100644 (file)
index ce5df5c..0000000
Binary files a/test-data/hero.png and /dev/null differ
diff --git a/test-data/maxim.png b/test-data/maxim.png
new file mode 100644 (file)
index 0000000..ce5df5c
Binary files /dev/null and b/test-data/maxim.png differ
diff --git a/test-data/selan.png b/test-data/selan.png
new file mode 100644 (file)
index 0000000..028cba4
Binary files /dev/null and b/test-data/selan.png differ