summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2022-07-27 23:01:56 -0300
committerJesusaves <cpntb1@ymail.com>2022-07-27 23:01:56 -0300
commit6ae2f97570075290d4661b92756a1e189f41097d (patch)
tree9d00f87bef899b8431cf8e6b1841da4e8cf3c8ad
parent65d3e9a83ec557d64a45c6c20cc16c2b95b45ec4 (diff)
downloadsdk-6ae2f97570075290d4661b92756a1e189f41097d.tar.gz
sdk-6ae2f97570075290d4661b92756a1e189f41097d.tar.bz2
sdk-6ae2f97570075290d4661b92756a1e189f41097d.tar.xz
sdk-6ae2f97570075290d4661b92756a1e189f41097d.zip
The advanced Unit Editor (creates 3 units in one go)
-rw-r--r--00_init.rpy1
-rw-r--r--qeditor.rpy3
-rw-r--r--ueditor.rpy27
-rw-r--r--ueditor_adv.rpy103
4 files changed, 124 insertions, 10 deletions
diff --git a/00_init.rpy b/00_init.rpy
index 64549e8..65eb7ff 100644
--- a/00_init.rpy
+++ b/00_init.rpy
@@ -19,6 +19,7 @@
init -3 python:
import json, copy, traceback
+ from collections import Counter
config.autoreload = False
config.save_on_mobile_background = False
ERR_JSONDECODER=101
diff --git a/qeditor.rpy b/qeditor.rpy
index dd19ddc..5d91bb2 100644
--- a/qeditor.rpy
+++ b/qeditor.rpy
@@ -202,8 +202,10 @@ screen quest_editor():
textbutton _("Save") action Function(qeditor_save)
textbutton _("Close") action Return()
+ null width 10
textbutton _("New Quest") action Function(qeditor_new)
textbutton _("New S.") action Function(qeditor_new, 1)
+ null width 10
textbutton _("Auto-New") action Jump("qeditor_supernew")
## Right-click and escape refresh screen
@@ -427,6 +429,7 @@ label quest_editors:
call screen quest_editor
$print("Quest Editor closed")
menu:
+ "Do you want to save the buffer?"
"Save Changes":
$ qeditor_save()
"Discard Changes":
diff --git a/ueditor.rpy b/ueditor.rpy
index 453dc02..4e56e3f 100644
--- a/ueditor.rpy
+++ b/ueditor.rpy
@@ -178,16 +178,17 @@ screen units_editor():
###########################################
null height 40
hbox:
- spacing 25
+ spacing 22
textbutton _("Save") action Function(ueditor_save)
textbutton _("Close") action Return()
- null width 20
+ null width 10
textbutton _("Recalc") action Function(ueditor_recalc)
- null width 20
+ null width 10
textbutton _("New Sub") action Function(ueditor_new, True)
textbutton _("New Unit") action Function(ueditor_new)
+ textbutton _("Auto") action Jump("ueditor_supernew")
## Right-click and escape refresh screen
key "game_menu" action Function(RestartInteraction)#Return()
@@ -245,7 +246,7 @@ init python:
sex=0
job=1
else:
- ueid=allunitsbase[current]["unit_id"]/100*100+1 # Truncate
+ ueid=allunitsbase[current]["unit_id"]//100*100+1 # Truncate
rar=allunitsbase[current]["rare"]+1
nam=allunitsbase[current]["name"]+" +"+str(rar)
attr=allunitsbase[current]["attribute"]
@@ -266,12 +267,12 @@ init python:
"job": job,
"cost": rar**2,
"flags": 0,
- "unit_base_id": ueid/100,
+ "unit_base_id": ueid//100,
"flavor": flav})
renpy.notify("New unit added: %d" % ueid)
return
- def ueditor_recalc():
+ def ueditor_recalc(notf=True, shp=0, ssr=0):
global uedit
uedit=allunitsbase[current]
job=uedit["job"]
@@ -291,21 +292,25 @@ init python:
STR=600;HP=200; # Gunner (unused)
elif job == 6:
STR = 0;HP = 0; # Special
+ # Apply the seed modifiers
+ STR += ssr
+ HP += shp
# Apply rarity modified
STR*=(rar+1)/2.0
HP*=(rar+1)/2.0
STR=max(int(STR), 1)
HP=max(int(HP), 1)
# Save data
- renpy.notify("%s\nHP %d->%d \n ATK %d->%d" % (uedit["name"],
- uedit["hp"], HP,
- uedit["strength"], STR))
+ if notf:
+ renpy.notify("%s\nHP %d->%d \n ATK %d->%d" % (uedit["name"],
+ uedit["hp"], HP,
+ uedit["strength"], STR))
uedit["strength"]=copy.copy(STR)
uedit["hp"]=copy.copy(HP)
allunitsbase[current]["strength"]=copy.copy(STR)
allunitsbase[current]["hp"]=copy.copy(HP)
# Correct unit family and max level if needed
- allunitsbase[current]["unit_base_id"]=allunitsbase[current]["unit_id"]/100
+ allunitsbase[current]["unit_base_id"]=allunitsbase[current]["unit_id"]//100
allunitsbase[current]["max_level"]=10+(rar*10)
return
@@ -436,7 +441,9 @@ label units_editors:
$print("")
call screen units_editor
$print("Unit Editor closed")
+ # FIXME: A button to revert instead
menu:
+ "Do you want to save the buffer?"
"Save Changes":
$ ueditor_save()
"Discard Changes":
diff --git a/ueditor_adv.rpy b/ueditor_adv.rpy
new file mode 100644
index 0000000..9f53a02
--- /dev/null
+++ b/ueditor_adv.rpy
@@ -0,0 +1,103 @@
+#################################################################################
+# This file is part of Spheres.
+# Copyright (C) 2022 Jesusalva
+
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#################################################################################
+# Editor labels for developers
+label ueditor_supernew:
+ $ rar = int(renpy.input("What is the base unit rarity?", allow="0123456789"))
+ python:
+ c = Counter()
+ for u in allunitsbase:
+ if u["unit_id"] % 10:
+ continue
+ if u["flags"]:
+ continue
+ c[u["rare"]] += 1
+ lastid = c[rar] + 2 # We start at 1, not at 0
+
+ $ unitid = int("1%02d%03d" % (rar, lastid))
+
+ $ name = renpy.input("How is this [rar]★ unit called?\nIts ID is: [unitid]")
+
+ menu:
+ "Male":
+ $ sex = 0
+ "Female":
+ $ sex = 1
+
+ menu:
+ "Please select the unit element:"
+ "Fire":
+ $ ele = Ele_Fire
+ "Water":
+ $ ele = Ele_Water
+ "Nature":
+ $ ele = Ele_Nature
+ "Light":
+ $ ele = Ele_Light
+ "Shadow":
+ $ ele = Ele_Shadow
+
+ menu:
+ "Please select the unit job:"
+ "Swordsman (DEF+)":
+ $ job = 1
+ "Assassin (Balanced)" if False:
+ $ job = 2
+ "Mage (ATK+)":
+ $ job = 3
+ "Archer (Balanced)":
+ $ job = 4
+ "Gunner (ATK++)" if False:
+ $ job = 5
+
+ $ desc = renpy.input("Describe the unit.", default="A standard unit in the game.")
+
+ python:
+ # Create the randomness seed
+ ssr=renpy.random.randint(-10, 15)
+ shp=renpy.random.randint(-10, 15)
+ i=0
+ while i < 3:
+ if i == 0:
+ atd = ""
+ else:
+ atd = " +%d" % i
+ allunitsbase.append({"skill_id": 0,
+ "strength": 500,
+ "rare": rar+i,
+ "name": "%s%s" % (name, atd),
+ "ability_id": 0,
+ "attribute": ele,
+ "hp": 500,
+ "unit_id": unitid*100+i,
+ "sex": sex,
+ "max_level": 10+(rar*10),
+ "job": job,
+ "cost": rar**2,
+ "flags": 0,
+ "unit_base_id": unitid,
+ "flavor": desc})
+ current = len(allunitsbase)-1
+ ueditor_recalc(False, shp, ssr)
+ i+=1
+ pass
+
+ $ ueditor_save()
+ jump units_editors
+
+