summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-08-12 21:52:09 -0300
committerJesusaves <cpntb1@ymail.com>2021-08-12 21:52:09 -0300
commitb8245cdc982e1c9d981c73875f4f7e6caf319d0f (patch)
treeb303415f2f71774a2c89f3ae04c3f6f93da2938d
parent08ed7098e4df53a8ede5f65e27e77c783edfb901 (diff)
downloadserver-b8245cdc982e1c9d981c73875f4f7e6caf319d0f.tar.gz
server-b8245cdc982e1c9d981c73875f4f7e6caf319d0f.tar.bz2
server-b8245cdc982e1c9d981c73875f4f7e6caf319d0f.tar.xz
server-b8245cdc982e1c9d981c73875f4f7e6caf319d0f.zip
Remove summon_id attribute from summons.json; Rely entirely on the array pos
-rw-r--r--battle/main.py1
-rw-r--r--battle/summons.py11
-rw-r--r--summons.json11
3 files changed, 12 insertions, 11 deletions
diff --git a/battle/main.py b/battle/main.py
index 48f95c9..a477171 100644
--- a/battle/main.py
+++ b/battle/main.py
@@ -27,7 +27,6 @@ import player
from battle.common import (find_target, calc_dmg, conditions, advance_wave,
battle_endturn)
from battle.spheres import sphere_attack
-#from battle.summons import summon # <-- Protocol?
#from battle.skills import skill_core, handle_skill # <-- WIP
from copy import copy
diff --git a/battle/summons.py b/battle/summons.py
index ec60b7c..f3009df 100644
--- a/battle/summons.py
+++ b/battle/summons.py
@@ -24,12 +24,12 @@ from battle.skills import skill_core
from battle.common import conditions
#from battle.main import advance_wave, battle_endturn, get_result
-def handle_summon(token, summon):
+def handle_summon(token, summon, summon_id):
global Battle, Player
try:
# Log that summon was used (single action log)
- Battle[token]["log"]=[["", 0, SRV_SUMMON, summon["summon_id"], "", 0]]
+ Battle[token]["log"]=[["", 0, SRV_SUMMON, summon_id, "", 0]]
# Summon strength is based on player rank
force=summon["strength"]*Player[token]["level"]
@@ -64,10 +64,7 @@ def summon(args, token):
summon_id=int(ss[0])
# Create summon object
- summon=dl_search(allsummons, "summon_id", summon_id)
- if summon == "ERROR":
- stdout("ERROR, INVALID SUMMON ID %d" % summon_id)
- raise Exception("Invalid summon")
+ summon=allsummons[summon_id]
# Verify the cost
if Battle[token]["bp"] < summon["cost"]:
@@ -89,7 +86,7 @@ def summon(args, token):
Battle[token]["bp"]-=summon["cost"]
Battle["s"]=1
- return handle_summon(token, summon)
+ return handle_summon(token, summon, summon_id)
#################################################
diff --git a/summons.json b/summons.json
index 00da5fa..62c2daa 100644
--- a/summons.json
+++ b/summons.json
@@ -1,6 +1,5 @@
[
{
- "summon_id": 1,
"name": "Little Wonders",
"desc": "Small HP healing to all allies.",
"type": 64,
@@ -9,7 +8,6 @@
"cost": 10
},
{
- "summon_id": 2,
"name": "Spirit of Battle",
"desc": "Small HP healing to all allies. Buffs attack.",
"type": 72,
@@ -18,12 +16,19 @@
"cost": 20
},
{
- "summon_id": 3,
"name": "Holy Blessing",
"desc": "Small HP healing and ATK buff to all allies. Holy damage to all enemies.",
"type": 76,
"strength": 20,
"attribute": 4,
"cost": 30
+ },
+ {
+ "name": "Debug Lord",
+ "desc": "Small HP healing and ATK buff to all allies. Holy damage to all enemies.",
+ "type": 92,
+ "strength": 20,
+ "attribute": 4,
+ "cost": 0
}
]