From b28e8f54081d411da41684d6b161b94d0f254476 Mon Sep 17 00:00:00 2001
From: Jesusaves <cpntb1@ymail.com>
Date: Wed, 23 Dec 2020 18:40:16 -0300
Subject: Fix remaining instances

---
 game/party.rpy |  7 +------
 game/units.rpy | 42 ++++++------------------------------------
 2 files changed, 7 insertions(+), 42 deletions(-)

diff --git a/game/party.rpy b/game/party.rpy
index 54c3042..7fe8c47 100644
--- a/game/party.rpy
+++ b/game/party.rpy
@@ -102,12 +102,7 @@ screen party_main():
             for i, item in enumerate(Player["party_%d" % party]):
                 imagebutton:
                     if item["unit_id"] > 0:
-                        idle At(Composite(
-                                (340, 340),
-                                (0, 0), "gfx/square/bg.png",
-                                (0, 0), "gfx/square/units/%d.png" % item["unit_id"],
-                                (0, 0), "gfx/square/%d.png" % allunits[item["unit_id"]]["rare"],
-                            ), czoom_70)
+                        idle unitsquare(item["unit_id"], czoom_70)
                     else:
                         idle At("gfx/square/bg.png", czoom_70)
                     action Return([party, i])
diff --git a/game/units.rpy b/game/units.rpy
index 3abaeef..74c9bf0 100644
--- a/game/units.rpy
+++ b/game/units.rpy
@@ -39,12 +39,7 @@ screen upgrade_char():
 
         # The unit
         hbox:
-            add At(Composite(
-                        (340, 340),
-                        (0, 0), "gfx/square/bg.png",
-                        (0, 0), "gfx/square/units/%d.png" % unit["unit_id"],
-                        (0, 0), "gfx/square/%d.png" % unit["rare"],
-                    ), czoom_70)
+            add unitsquare(unit["unit_id"], czoom_70)
             null width 10
             label _("{size=32}{color=#fff}%s{/color}{/size}" % (unit["name"]))
 
@@ -55,12 +50,7 @@ screen upgrade_char():
                 if i < 4:
                     imagebutton:
                         if material[i] >= 0:
-                            idle At(Composite(
-                                    (340, 340),
-                                    (0, 0), "gfx/square/bg.png",
-                                    (0, 0), "gfx/square/units/%d.png" % Player["inv"][material[i]]["unit_id"],
-                                    (0, 0), "gfx/square/%d.png" % allunits[Player["inv"][material[i]]["unit_id"]]["rare"],
-                                ), czoom_70)
+                            idle unitsquare(Player["inv"][material[i]]["unit_id"], czoom_70)
                         else:
                             idle At("gfx/square/bg.png", czoom_70)
                         action Return(i)
@@ -72,12 +62,7 @@ screen upgrade_char():
                 if i < 8:
                     imagebutton:
                         if material[i] >= 0:
-                            idle At(Composite(
-                                    (340, 340),
-                                    (0, 0), "gfx/square/bg.png",
-                                    (0, 0), "gfx/square/units/%d.png" % Player["inv"][material[i]]["unit_id"],
-                                    (0, 0), "gfx/square/%d.png" % allunits[Player["inv"][material[i]]["unit_id"]]["rare"],
-                                ), czoom_70)
+                            idle unitsquare(Player["inv"][material[i]]["unit_id"], czoom_70)
                         else:
                             idle At("gfx/square/bg.png", czoom_70)
                         action Return(i)
@@ -98,21 +83,11 @@ screen evolve_char():
 
         # The unit
         hbox:
-            add At(Composite(
-                        (340, 340),
-                        (0, 0), "gfx/square/bg.png",
-                        (0, 0), "gfx/square/units/%d.png" % unit["unit_id"],
-                        (0, 0), "gfx/square/%d.png" % unit["rare"],
-                    ), czoom_70)
+            add unitsquare(unit["unit_id"], czoom_70)
             null width 10
             add At("gfx/evol.png", czoom_70)
             null width 10
-            add At(Composite(
-                        (340, 340),
-                        (0, 0), "gfx/square/bg.png",
-                        (0, 0), "gfx/square/units/%d.png" % next["unit_id"],
-                        (0, 0), "gfx/square/%d.png" % next["rare"],
-                    ), czoom_70)
+            add unitsquare(next["unit_id"], czoom_70)
             #label _("{size=32}{color=#fff}%s\n↓\n%s{/color}{/size}" % (unit["name"], next["name"]))
 
         null height 120
@@ -124,12 +99,7 @@ screen evolve_char():
                 if i < 2:
                     imagebutton:
                         if material[i] >= 0:
-                            idle At(Composite(
-                                    (340, 340),
-                                    (0, 0), "gfx/square/bg.png",
-                                    (0, 0), "gfx/square/units/%d.png" % Player["inv"][material[i]]["unit_id"],
-                                    (0, 0), "gfx/square/%d.png" % allunits[Player["inv"][material[i]]["unit_id"]]["rare"],
-                                ), czoom_70)
+                            idle unitsquare(Player["inv"][material[i]]["unit_id"], czoom_70)
                         else:
                             idle At("gfx/square/bg.png", czoom_70)
                         action Return(i)
-- 
cgit v1.2.3-70-g09d2