summaryrefslogtreecommitdiff
path: root/qeditor_adv.rpy
blob: 45d67485fb1dcdec0db5e66ed92669740493b47c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#################################################################################
#     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 qeditor_supernew:
    python:
        elemt = 0
        bosse = 0
        queid = len(allquests)
        waves = 3

        avail = []
        mobid = []
        subid = 0
        bosid = 0

    menu:
        "Please select the predominant element:"
        "Fire":
            $ elemt = Ele_Fire
        "Water":
            $ elemt = Ele_Water
        "Nature":
            $ elemt = Ele_Nature
        "Light":
            $ elemt = Ele_Light
        "Shadow":
            $ elemt = Ele_Shadow

    $ elemt_txt = ParseEle(elemt)
    menu:
        "Please select the BOSS element (current: [elemt_txt]):"
        "Fire":
            $ bosse = Ele_Fire
        "Water":
            $ bosse = Ele_Water
        "Nature":
            $ bosse = Ele_Nature
        "Light":
            $ bosse = Ele_Light
        "Shadow":
            $ bosse = Ele_Shadow

    $ queid = int(renpy.input("Please define the quest ID, default = [queid], special = 90000", allow="0123456789"))
    menu:
        "Please select the theme"
        "The Empire":
          python:
            avail=[950001, 950002, 950003, 950004, 950005]
            subid=renpy.random.choice(avail)
            avail.remove(subid)
            bosid=renpy.random.choice(avail)
            avail.remove(bosid)
            mobid=avail
        #"The Bandits":
        #"The Elves":
        #"The Dark Horde":
        #"The Darklanders":
        #"The Rebels":
        #"The Land of Fire":
        "The Wizard Order":
          python:
            avail=[950700, 950701, 950702]
            subid=renpy.random.choice(avail)
            avail.remove(subid)
            bosid=renpy.random.choice(avail)
            avail.remove(bosid)
            mobid=avail
        #"The Dwarves":
        "Custom":
          python:
            bosid=int(renpy.input("Please define boss ID", allow="0123456789"))
            subid=int(renpy.input("Please define extra ID", allow="0123456789"))
            avail=renpy.input("Please define mobs ID (comma-separated) (boss=[bosid], sub=[subid])", allow="0123456789,").split(",")
            mobid=[]
            for i in avail:
                mobid.append(int(i))

    # Generate the struct and save it
    # TODO: If renpy.exists() with 96 then upgrade else do nothing?
    python:
        qeid = int(queid)
        qefl = 1
        if qeid > 90000:
            qeid = queid - 90000
            qefl = 4

        # 2 then 3
        qdif = 2 + (qeid//2)*5 + (qeid%2)*3

        allquests.append({
        "quest_id": queid,
        "difficulty": qdif, # FIXME too steep
        "requeriment": qeid-1,
        "cost": 1+(qeid / 5),
        "flags": qefl,
        "music": "bgm03",
        "bg": "battle",
        "loot": [
                    ["1010", int(1000+(qeid/5*25))],
                    ["1020", int(100+(qeid/5*10))],
                    ["1030", int(10+(qeid/5))]
                ],
        "waves": []})

        # Generate waves
        #current=dl_search(allquests, "quest_id", queid)
        current=len(allquests)-1
        qedit=allquests[current]
        it = ifte(qeid % 5 == 0, 4, 3) # 4 waves every 5 fights
        i = 0
        while i < it:
            qedit["waves"].append([])
            j = 0
            k = ifte((i+1) == it, 1, ifte((i+1) == 2, 2, 3))
            while j < k:
                j+=1
                if k == 1:
                    tmp_sp = bosid + 10000 # FIXME
                elif k == 2:
                    tmp_sp = subid
                else:
                    tmp_sp = renpy.random.choice(mobid)
                if k == 1:
                    tmp_nm = "BOSS" # FIXME
                else:
                    tmp_nm = "Enemy %d" % j # FIXME
                qedit["waves"][i].append({
                "name": tmp_nm,
                "sprite": int(tmp_sp),
                "attribute": int(ifte((i+1) == it, bosse, elemt)),
                "boss": ifte((i+1) == it, True, False)
            })
            i += 1

        renpy.notify("New quest added: %d" % queid)
    return