Generate generic ai actions for magic damage

merge/2021-11-19
kaetemi 3 years ago
parent 7ecc87e3ed
commit 62ed0d6de9
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -0,0 +1,60 @@
arma
bul
c1
c2
c3
c4
c5
c6
c7
capryni
cephaloplant
chonari
cococlaw
cute
dag
diranak
electroalgs
estrasson
filin
frahar
gibbai
h1
h2
h3
h4
h5
h6
h7
h8
h9
h10
h11
h12
hachtaha
jungler
kakty
kazoar
kitifly
kitihank
kitiharak
kitikil
kitimandib
kitinagan
kitinega
kitinokto
lightbird
mektoub
phytopsy
pucetron
regus
ryzerb
ryzoholo
ryzoholok
sap_enslaver
spitting_weeds
swarmplants
vampignon
varinx
yber
zerx
1 arma
2 bul
3 c1
4 c2
5 c3
6 c4
7 c5
8 c6
9 c7
10 capryni
11 cephaloplant
12 chonari
13 cococlaw
14 cute
15 dag
16 diranak
17 electroalgs
18 estrasson
19 filin
20 frahar
21 gibbai
22 h1
23 h2
24 h3
25 h4
26 h5
27 h6
28 h7
29 h8
30 h9
31 h10
32 h11
33 h12
34 hachtaha
35 jungler
36 kakty
37 kazoar
38 kitifly
39 kitihank
40 kitiharak
41 kitikil
42 kitimandib
43 kitinagan
44 kitinega
45 kitinokto
46 lightbird
47 mektoub
48 phytopsy
49 pucetron
50 regus
51 ryzerb
52 ryzoholo
53 ryzoholok
54 sap_enslaver
55 spitting_weeds
56 swarmplants
57 vampignon
58 varinx
59 yber
60 zerx

@ -0,0 +1,103 @@
import os, zlib
meleeSpec = [ "slashing", "piercing", "blunt" ]
curseSpec = [ "blind", "fear", "madness", "root", "sleep", "slow", "snare", "stun" ]
magicSpec = [ "acid", "cold", "rot", "fire", "poison", "electricity", "shockwave" ]
variantSpec = [ "a", "b", "c", "d", "e", "f" ] # Newbie, Basic, Fine, Choice, Excellent, Supreme
aiActionFolder = "R:\\leveldesign\\game_elem\\creature\\npc\\bestiary\\aiaction\\generic"
if not os.path.isdir(aiActionFolder):
os.makedirs(aiActionFolder)
base = {
"combat": {
"fauna": meleeSpec,
"melee": meleeSpec,
"range": meleeSpec,
},
# "hybrid": {
# "melee": meleeSpec * magicSpec,
# "range": meleeSpec * magicSpec,
# },
"magic": {
"damage": magicSpec,
"dot": magicSpec,
"heal": [ "hp", "sap", "stamina", "focus" ],
"curse": curseSpec,
},
# "debuff": {
# "skill": [ "melee", "range", "magic" ],
# "resist": magicSpec,
# },
}
# Damage
# ------
# Total Magic Damage = DamageValue + (SpellPowerFactor * creature.AttackLevel)
# Let's say 10k average total HP for homins and creatures at lvl 250
# Linear increase of 40 HP per level, so 400 HP per 10 levels, or 200 HP every 5 levels
maxLevel = 250
averageMaxHP = 10000
# Settle a fight in 10 seconds, that's an attack of 1000 at lvl 250 for a 1 second attack
# Add a base boost of 10 levels, that's 40 base attack
combatTime = 10
# Magic may do double the damage of melee
magicDamageBoost = 2
# Different boosts for each variant
variantBoost = { "a": 0.1, "b": 1.0, "c": 1.25, "d": 1.75, "e": 2.5, "f": 4.0 }
variantBaseLevel = { "a": 5, "b": 5, "c": 10, "d": 15, "e": 20, "f": 25 }
randomVariance = 0.1 # Random variance on the generated sheets
# Spell time
spellBaseTime = 1
spellRandomBaseTime = 2
spellPostTime = 0.5
spellRandomPostTime = 1
# magic_damage
for spec in magicSpec:
for variant in variantSpec:
name = "magic_damage_" + spec + "_" + variant
randBoostFactor = zlib.crc32("SpellPowerFactor" + name) & 0xffffffff
randBoostFactor = (((randBoostFactor % 2000) - 1000) * randomVariance) / 1000.0
randBoostAdd = zlib.crc32("DamageValue" + name) & 0xffffffff
randBoostAdd = (((randBoostAdd % 2000) - 1000) * randomVariance) / 1000.0
randBaseTime = zlib.crc32("CastingTime" + name) & 0xffffffff
randBaseTime = ((randBaseTime % 1000) * spellRandomBaseTime) / 1000.0
randPostTime = zlib.crc32("PostActionTime" + name) & 0xffffffff
randPostTime = ((randPostTime % 1000) * spellRandomPostTime) / 1000.0
baseTime = int((spellBaseTime + randBaseTime) * 10) * 0.1
postTime = int((spellPostTime + randPostTime) * 10) * 0.1
totalTime = baseTime + postTime
maxLevelDamage = (averageMaxHP * totalTime * magicDamageBoost) / combatTime
damagePerLevel = maxLevelDamage / maxLevel
damagePerLevelFactor = (damagePerLevel + (damagePerLevel * randBoostFactor)) * variantBoost[variant]
damageAdd = (damagePerLevel + (damagePerLevel * randBoostAdd)) * variantBaseLevel[variant]
behaviour = "CAST_" + spec.upper()
if behaviour == "CAST_ELECTRICITY":
behaviour = "CAST_ELEC"
if behaviour == "CAST_SHOCKWAVE":
behaviour = "CAST_SHOCK"
damageType = spec.upper()
if damageType == "SHOCKWAVE":
damageType = "SHOCK"
with open(aiActionFolder + "\\" + name + ".aiaction", "w") as f:
f.write("<?xml version=\"1.0\"?>\n")
f.write("<FORM Version=\"4.0\" State=\"modified\">\n")
f.write(" <STRUCT>\n")
f.write(" <ATOM Name=\"type\" Value=\"DamageSpell\"/>\n")
f.write(" <ATOM Name=\"Behaviour\" Value=\"" + behaviour + "\"/>\n")
f.write(" <ATOM Name=\"SpellPowerFactor\" Value=\"" + str(round(damagePerLevelFactor, 3))+ "\"/>\n")
f.write(" <ATOM Name=\"DamageScore\" Value=\"HitPoints\"/>\n")
f.write(" <ATOM Name=\"DamageType\" Value=\"" + damageType + "\"/>\n")
f.write(" <ATOM Name=\"DamageValue\" Value=\"" + str(int(damageAdd)) + "\"/>\n")
f.write(" <ATOM Name=\"CastingTime\" Value=\"" + str(baseTime) + "\"/>\n")
f.write(" <ATOM Name=\"PostActionTime\" Value=\"" + str(postTime) + "\"/>\n")
f.write(" </STRUCT>\n")
f.write("</FORM>\n")

@ -17,3 +17,6 @@ ring melee hands: blunt pierce slash
ring magic hands: acid cold electricity fire poison rot shockwave
ring magic curser hands: blind fear madness root sleep slow snare stun
ring level: 1 2 3 4
creature levels: a(0-20) b(20-50) c(50-100) d(100-150) e(150-200) f(200-250)
creature levels: b1 b2 b3 b4 (b5 b6 b7) - variants within the level range

Loading…
Cancel
Save