Refactored Book of Virtues Wisp description construction

This commit is contained in:
Wofsauge committed 2025-05-08 22:40:52 +02:00
1 parent b9f217eae3
commit 412e8e3348
13 files changed
+494 -375

No files matched your search

+69
View File
@@ -23,6 +23,7 @@ maxItemID = 0
pillMetadatas = []
entityNames = []
locusts = []
wisps = []
recipeIngredients = {}
recipeIngredients["h"] = 1 # Red Heart
@@ -169,6 +170,46 @@ for locust in locustsXML.findall('locust'):
}
)
wispsXML = ET.parse(filePath + 'wisps.xml').getroot()
for wisp in wispsXML.findall('wisp'):
id = wisp.get('id')
if "s" in id: # ignore special wisp variants
continue
hp = wisp.get('hp') or 2
layer = wisp.get('layer') or 1
damage = wisp.get('damage') or 3
damageMultiplier2 = wisp.get('damageMultiplier2') or 1
stageDamage = wisp.get('stageDamage') or 0.1
shotSpeed = wisp.get('shotSpeed') or 1
fireDelay = wisp.get('fireDelay') or 30
tearFlags = wisp.get('tearFlags') or -1
tearFlags2 = wisp.get('tearFlags2') or -1
procChance = wisp.get('procChance') or 1
canShoot = wisp.get('canShoot') or True
count = wisp.get('count') or 1
wisps.append(
{
"id": id,
"hp": hp,
"layer": layer,
"damage": damage,
"stageDamage": stageDamage,
"damageMultiplier2": damageMultiplier2,
"shotSpeed": shotSpeed,
"fireDelay": fireDelay,
"procChance": procChance,
"canShoot": canShoot,
"count": count,
"tearFlags": list(map(int, str(tearFlags).split(" "))),
"tearFlags2": list(map(int, str(tearFlags2).split(" "))),
}
)
def wispSortFunc(e):
return int(e["id"])
wisps.sort(key=wispSortFunc)
# Write xml file
newfile = open(writeToFile, "w")
@@ -233,6 +274,34 @@ for locust in locusts:
newfile.write("}\n\n")
newfile.write("-- effect storage for each wisp generated by Book of Virtues\n")
newfile.write("EID.XMLWisps = {")
counter = 0
for wisp in wisps:
counter = counter+1
tempString = ""
tempString += "["+str(wisp['id'])+"] = {"
tempString += str(wisp['hp'])+", "
tempString += str(wisp['layer'])+", "
tempString += str(wisp['damage'])+", "
tempString += str(wisp['stageDamage'])+", "
tempString += str(wisp['damageMultiplier2'])+", "
tempString += str(wisp['shotSpeed'])+", "
tempString += str(wisp['fireDelay'])+", "
tempString += str(wisp['procChance'])+", "
tempString += str(wisp['canShoot']).lower()+", "
tempString += str(wisp['count'])+", "
# locustFlags and tearFLags can have space seperated values in them
tempString += str(wisp['tearFlags']).replace("[","{").replace("]","}")+", "
tempString += str(wisp['tearFlags2']).replace("[","{").replace("]","}")
tempString += "}, "
if counter > 50:
newfile.write(tempString+"\n")
counter = 0
else:
newfile.write(tempString)
newfile.write("}\n\n")
newfile.write("--The name of each entity, for use in glitched item descriptions\n")
newfile.write("EID.XMLEntityNames = {")
tempString = ""