aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/army/balance 1000 melee.txtbin21560 -> 21560 bytes
-rw-r--r--build/army/balance 1000 the second.txtbin21560 -> 21560 bytes
-rw-r--r--build/content/__results.pngbin0 -> 38325 bytes
-rw-r--r--build/content/armor.txt198
-rw-r--r--build/content/augments.txt253
-rw-r--r--build/content/autolevel.py38
-rw-r--r--build/content/batteries.txt102
-rw-r--r--build/content/brains.txt38
-rw-r--r--build/content/chassis.txt472
-rw-r--r--build/content/coso.py154
-rw-r--r--build/content/templates/default.txt4
-rw-r--r--build/content/weapons.txt814
-rw-r--r--build/test.exebin794781 -> 819801 bytes
-rw-r--r--design/design.txt9
-rw-r--r--gst/info.c299
-rw-r--r--gst/info.h55
-rw-r--r--hud/hud.c30
-rw-r--r--hud/hud_views.c11
-rw-r--r--json/jsonparse.c2
-rw-r--r--main.c2
20 files changed, 1398 insertions, 1083 deletions
diff --git a/build/army/balance 1000 melee.txt b/build/army/balance 1000 melee.txt
index 0672fd9..727e08a 100644
--- a/build/army/balance 1000 melee.txt
+++ b/build/army/balance 1000 melee.txt
Binary files differ
diff --git a/build/army/balance 1000 the second.txt b/build/army/balance 1000 the second.txt
index 48b8155..ef02fec 100644
--- a/build/army/balance 1000 the second.txt
+++ b/build/army/balance 1000 the second.txt
Binary files differ
diff --git a/build/content/__results.png b/build/content/__results.png
new file mode 100644
index 0000000..8a527cb
--- /dev/null
+++ b/build/content/__results.png
Binary files differ
diff --git a/build/content/armor.txt b/build/content/armor.txt
index 5ceaacc..de31e24 100644
--- a/build/content/armor.txt
+++ b/build/content/armor.txt
@@ -1,200 +1,200 @@
[
{
"name": "metal plating",
- "weight": [
+ "base_weight": [
10.0,
- 10.0,
- 10.0
+ 7.5,
+ 5.0
],
- "pierce": [
+ "base_pierce": [
5.0,
- 5.0,
- 5.0
+ 6.25,
+ 7.5
],
- "spread": [
- 8.0,
+ "base_spread": [
8.0,
- 8.0
+ 10.0,
+ 12.0
]
},
{
"name": "heavy metal plating",
- "weight": [
+ "base_weight": [
16.0,
- 16.0,
- 16.0
+ 12.0,
+ 8.0
],
- "pierce": [
+ "base_pierce": [
7.0,
- 7.0,
- 7.0
+ 8.75,
+ 10.5
],
- "spread": [
- 10.0,
+ "base_spread": [
10.0,
- 10.0
+ 12.5,
+ 15.0
],
- "impact": [
- 5.0,
+ "base_impact": [
5.0,
- 5.0
+ 6.25,
+ 7.5
]
},
{
"name": "reflective plating",
- "weight": [
+ "base_weight": [
8.0,
- 8.0,
- 8.0
+ 6.0,
+ 4.0
],
- "laser": [
- 10.0,
+ "base_laser": [
10.0,
- 10.0
+ 12.5,
+ 15.0
]
},
{
"name": "heat resistent plating",
- "weight": [
- 10.0,
+ "base_weight": [
10.0,
- 10.0
+ 7.5,
+ 5.0
],
- "fusion": [
- 8.0,
+ "base_fusion": [
8.0,
- 8.0
+ 10.0,
+ 12.0
]
},
{
"name": "padding",
- "weight": [
+ "base_weight": [
4.0,
- 4.0,
- 4.0
+ 3.0,
+ 2.0
],
- "spread": [
- 5.0,
+ "base_spread": [
5.0,
- 5.0
+ 6.25,
+ 7.5
],
- "impact": [
- 8.0,
+ "base_impact": [
8.0,
- 8.0
+ 10.0,
+ 12.0
]
},
{
"name": "reactive armor",
- "weight": [
- 15.0,
+ "base_weight": [
15.0,
- 15.0
+ 11.25,
+ 7.5
],
- "explosive": [
- 12.0,
+ "base_explosive": [
12.0,
- 12.0
+ 15.0,
+ 18.0
]
},
{
"name": "energy shields",
- "weight": [
- 5.0,
+ "base_weight": [
5.0,
- 5.0
+ 3.75,
+ 2.5
],
- "pierce": [
- 3.0,
+ "base_pierce": [
3.0,
- 3.0
+ 3.75,
+ 4.5
],
- "spread": [
+ "base_spread": [
3.0,
- 3.0,
- 3.0
+ 3.75,
+ 4.5
],
- "fusion": [
- 3.0,
+ "base_fusion": [
3.0,
- 3.0
+ 3.75,
+ 4.5
],
- "explosive": [
- 3.0,
+ "base_explosive": [
3.0,
- 3.0
+ 3.75,
+ 4.5
],
- "laser": [
+ "base_laser": [
3.0,
- 3.0,
- 3.0
+ 3.75,
+ 4.5
]
},
{
"name": "composite armor",
- "weight": [
- 6.0,
+ "base_weight": [
6.0,
- 6.0
+ 4.5,
+ 3.0
],
- "pierce": [
- 6.0,
+ "base_pierce": [
6.0,
- 6.0
+ 7.5,
+ 9.0
],
- "spread": [
- 4.0,
+ "base_spread": [
4.0,
- 4.0
+ 5.0,
+ 6.0
],
- "impact": [
- 3.0,
+ "base_impact": [
3.0,
- 3.0
+ 3.75,
+ 4.5
]
},
{
"name": "plastic armor",
- "weight": [
+ "base_weight": [
2.0,
- 2.0,
- 2.0
+ 1.5,
+ 1.0
],
- "pierce": [
- 4.0,
+ "base_pierce": [
4.0,
- 4.0
+ 5.0,
+ 6.0
]
},
{
"name": "sloped steel armor",
- "weight": [
+ "base_weight": [
9.0,
- 9.0,
- 9.0
+ 6.75,
+ 4.5
],
- "pierce": [
+ "base_pierce": [
10.0,
- 10.0,
- 10.0
+ 12.5,
+ 15.0
],
- "spread": [
+ "base_spread": [
8.0,
- 8.0,
- 8.0
+ 10.0,
+ 12.0
]
},
{
"name": "charged armor",
- "weight": [
- 20.0,
+ "base_weight": [
20.0,
- 20.0
+ 15.0,
+ 10.0
],
- "explosive": [
- 25.0,
+ "base_explosive": [
25.0,
- 25.0
+ 31.25,
+ 37.5
]
}
] \ No newline at end of file
diff --git a/build/content/augments.txt b/build/content/augments.txt
index 6582a7e..35e5bba 100644
--- a/build/content/augments.txt
+++ b/build/content/augments.txt
@@ -1,59 +1,59 @@
[
{
"name": "charged ammo",
- "weight": [
+ "base_weight": [
10.0,
- 10.0,
- 10.0
+ 12.5,
+ 15.0
],
- "damage_emp": [
- 5.0,
+ "base_weapon_damage_emp": [
5.0,
- 5.0
+ 6.25,
+ 7.5
]
},
{
"name": "fusion ammo",
- "weight": [
+ "base_weight": [
10.0,
- 10.0,
- 10.0
+ 12.5,
+ 15.0
],
- "damage_fusion": [
- 4.0,
+ "base_weapon_damage_fusion": [
4.0,
- 4.0
+ 5.0,
+ 6.0
]
},
{
"name": "explosive ammo",
- "weight": [
- 30.0,
+ "base_weight": [
30.0,
- 30.0
+ 37.5,
+ 45.0
],
- "armor_explosive": [
+ "base_armor_explosive": [
8.0,
- 8.0,
- 8.0
+ 10.0,
+ 12.0
]
},
{
"name": "radiator",
- "weight": [
+ "base_weight": [
10.0,
- 10.0,
- 10.0
+ 12.5,
+ 15.0
],
- "armor_fusion": [
- 2.0,
+ "base_armor_fusion": [
2.0,
- 2.0
+ 2.5,
+ 3.0
]
},
{
"name": "priority module",
- "weight": [
+ "base_weight": [
0.0,
0.0,
0.0
@@ -61,27 +61,27 @@
},
{
"name": "communication array",
- "weight": [
+ "base_weight": [
50.0,
- 50.0,
- 50.0
+ 62.5,
+ 75.0
],
- "armor_pierce": [
- 1.0,
+ "base_armor_pierce": [
1.0,
- 1.0
+ 1.25,
+ 1.5
],
- "armor_impact": [
- 1.0,
+ "base_armor_impact": [
1.0,
- 1.0
+ 1.25,
+ 1.5
],
- "armor_fusion": [
+ "base_armor_fusion": [
1.0,
- 1.0,
- 1.0
+ 1.25,
+ 1.5
],
- "aoe": [
+ "base_aoe": [
2.0,
2.0,
2.0
@@ -89,185 +89,172 @@
},
{
"name": "long range targeting",
- "weight": [
+ "base_weight": [
0.0,
0.0,
0.0
],
- "add_range": [
- 1.0,
+ "perc_range": [
1.0,
- 1.0
- ]
- },
- {
- "name": "long range targeting",
- "weight": [
- 0.0,
- 0.0,
- 0.0
- ],
- "range": [
- 1.0,
- 1.0,
- 1.0
+ 1.25,
+ 1.5
]
},
{
"name": "fast target acquisition",
- "weight": [
+ "base_weight": [
5.0,
- 5.0,
- 5.0
+ 6.25,
+ 7.5
],
- "add_cooldown": [
- -0.1,
+ "perc_weapon_cooldown": [
-0.1,
- -0.1
+ -0.125,
+ -0.15000000000000002
]
},
{
"name": "overcharger",
- "weight": [
- 10.0,
+ "base_weight": [
10.0,
- 10.0
+ 12.5,
+ 15.0
],
- "damage_laser": [
+ "base_weapon_damage_laser": [
8.0,
- 8.0,
- 8.0
+ 10.0,
+ 12.0
],
- "recharge": [
+ "base_recharge": [
-5.0,
- -5.0,
- -5.0
+ -6.25,
+ -7.5
]
},
{
"name": "focus lens",
- "weight": [
- 3.0,
+ "base_weight": [
3.0,
- 3.0
+ 3.75,
+ 4.5
],
- "damage_laser": [
- 3.0,
+ "base_weapon_damage_laser": [
3.0,
- 3.0
+ 3.75,
+ 4.5
]
},
{
"name": "amplifier",
- "weight": [
- 30.0,
+ "base_weight": [
30.0,
- 30.0
+ 37.5,
+ 45.0
],
- "damage_laser": [
+ "base_weapon_damage_laser": [
3.0,
- 3.0,
- 3.0
+ 3.75,
+ 4.5
],
- "damage_fusion": [
+ "base_weapon_damage_fusion": [
5.0,
- 5.0,
- 5.0
+ 6.25,
+ 7.5
]
},
{
"name": "shrapnel",
- "weight": [
- 5.0,
+ "base_weight": [
5.0,
- 5.0
+ 6.25,
+ 7.5
],
- "damage_explosive": [
+ "base_weapon_damage_explosive": [
5.0,
- 5.0,
- 5.0
+ 6.25,
+ 7.5
]
},
{
"name": "reloader",
- "weight": [
- 40.0,
+ "base_weight": [
40.0,
- 40.0
+ 50.0,
+ 60.0
],
- "add_cooldown": [
+ "perc_weapon_cooldown": [
-0.1,
- -0.1,
- -0.1
+ -0.125,
+ -0.15000000000000002
]
},
{
"name": "anti jamming device",
- "weight": [
- 2.0,
+ "base_weight": [
2.0,
- 2.0
+ 2.5,
+ 3.0
],
- "armor_emp": [
+ "base_armor_emp": [
5.0,
- 5.0,
- 5.0
+ 6.25,
+ 7.5
]
},
{
"name": "weight stripping",
- "weight": [
- -10.0,
+ "base_weight": [
-10.0,
- -10.0
+ -12.5,
+ -15.0
],
- "add_hp": [
+ "perc_hp": [
-10.0,
- -10.0,
- -10.0
+ -12.5,
+ -15.0
]
},
{
"name": "barebone weapon setup",
- "weight": [
- -30.0,
+ "base_weight": [
-30.0,
- -30.0
+ -37.5,
+ -45.0
],
- "damage_pierce": [
+ "base_weapon_damage_pierce": [
-25.0,
- -25.0,
- -25.0
+ -31.25,
+ -37.5
],
- "damage_laser": [
- -25.0,
+ "base_weapon_damage_laser": [
-25.0,
- -25.0
+ -31.25,
+ -37.5
],
- "damage_impact": [
+ "base_weapon_damage_impact": [
-25.0,
- -25.0,
- -25.0
+ -31.25,
+ -37.5
],
- "damage_fusion": [
- -25.0,
+ "base_weapon_damage_fusion": [
-25.0,
- -25.0
+ -31.25,
+ -37.5
],
- "damage_explosive": [
+ "base_weapon_damage_explosive": [
-25.0,
- -25.0,
- -25.0
+ -31.25,
+ -37.5
],
- "damage_emp": [
- -25.0,
+ "base_weapon_damage_emp": [
-25.0,
- -25.0
+ -31.25,
+ -37.5
],
- "damage_spread": [
- -25.0,
+ "base_weapon_damage_spread": [
-25.0,
- -25.0
+ -31.25,
+ -37.5
]
}
] \ No newline at end of file
diff --git a/build/content/autolevel.py b/build/content/autolevel.py
deleted file mode 100644
index 51d30f3..0000000
--- a/build/content/autolevel.py
+++ /dev/null
@@ -1,38 +0,0 @@
-import json
-
-def vectorize (obj, forbidlist, _):
- for c in obj:
- for key in c:
- if not(key in forbidlist):
- val = c[key]
- try: val = int(val);
- except: pass
- try: val = float(val);
- except: pass
- c[key] = [val for i in range(3)]
-
-def query (obj, allowlist, op):
- for c in obj:
- for key in c:
- if key in allowlist:
- c[key] = op(c[key])
-
-
-def comp(filename, l, fun, op=None):
- with open(filename+".txt", "r") as f: obj = json.loads(f.read())
- fun(obj, l, op)
- with open(filename+"-new"+".txt", "w") as f:
- f.write(json.dumps(obj, indent=4))
-
-if __name__ == "__main__":
- #comp("weapons", ["name", "damage_type"])
- #comp("augments", ["name"])
- #comp("batteries", ["name"])
- #comp("armor", ["name"])
- #comp("chassis", ["name"])
- #comp("brains", ["name"])
- #comp("brains", ["name"])
-
- amt = .5
- perc_inc = lambda x: [x[i]*(1.0+(i/2.0)*amt) for i in range(3)]
- comp("weapons", ["damage"], query, perc_inc)
diff --git a/build/content/batteries.txt b/build/content/batteries.txt
index baf7201..babab29 100644
--- a/build/content/batteries.txt
+++ b/build/content/batteries.txt
@@ -1,43 +1,43 @@
[
{
"name": "small alkaline pack",
- "weight": [
+ "base_weight": [
0.0,
0.0,
0.0
],
- "capacity": [
+ "base_capacity": [
50.0,
- 50.0,
- 50.0
+ 62.5,
+ 75.0
]
},
{
"name": "big alkaline pack",
- "weight": [
- 2.0,
+ "base_weight": [
2.0,
- 2.0
+ 1.5,
+ 1.0
],
- "capacity": [
- 200.0,
+ "base_capacity": [
200.0,
- 200.0
+ 250.0,
+ 300.0
]
},
{
"name": "small lithium pack",
- "weight": [
+ "base_weight": [
5.0,
- 5.0,
- 5.0
+ 3.75,
+ 2.5
],
- "capacity": [
- 150.0,
+ "base_capacity": [
150.0,
- 150.0
+ 187.5,
+ 225.0
],
- "recharge": [
+ "base_recharge": [
1,
1,
1
@@ -45,17 +45,17 @@
},
{
"name": "big lithium pack",
- "weight": [
+ "base_weight": [
15.0,
- 15.0,
- 15.0
+ 11.25,
+ 7.5
],
- "capacity": [
- 500.0,
+ "base_capacity": [
500.0,
- 500.0
+ 625.0,
+ 750.0
],
- "recharge": [
+ "base_recharge": [
1,
1,
1
@@ -63,17 +63,17 @@
},
{
"name": "lead battery",
- "weight": [
+ "base_weight": [
20.0,
- 20.0,
- 20.0
+ 15.0,
+ 10.0
],
- "capacity": [
- 800.0,
+ "base_capacity": [
800.0,
- 800.0
+ 1000.0,
+ 1200.0
],
- "recharge": [
+ "base_recharge": [
1,
1,
1
@@ -81,17 +81,17 @@
},
{
"name": "small molten salt battery",
- "weight": [
- 40.0,
+ "base_weight": [
40.0,
- 40.0
+ 30.0,
+ 20.0
],
- "capacity": [
- 1500.0,
+ "base_capacity": [
1500.0,
- 1500.0
+ 1875.0,
+ 2250.0
],
- "recharge": [
+ "base_recharge": [
1,
1,
1
@@ -99,17 +99,17 @@
},
{
"name": "big molten salt battery",
- "weight": [
+ "base_weight": [
70.0,
- 70.0,
- 70.0
+ 52.5,
+ 35.0
],
- "capacity": [
- 2000.0,
+ "base_capacity": [
2000.0,
- 2000.0
+ 2500.0,
+ 3000.0
],
- "recharge": [
+ "base_recharge": [
1,
1,
1
@@ -117,15 +117,15 @@
},
{
"name": "atomic battery",
- "weight": [
+ "base_weight": [
150.0,
- 150.0,
- 150.0
+ 112.5,
+ 75.0
],
- "capacity": [
- 10000.0,
+ "base_capacity": [
10000.0,
- 10000.0
+ 12500.0,
+ 15000.0
]
}
] \ No newline at end of file
diff --git a/build/content/brains.txt b/build/content/brains.txt
index 87d8d10..3201898 100644
--- a/build/content/brains.txt
+++ b/build/content/brains.txt
@@ -1,50 +1,50 @@
[
{
"name": "search and destroy",
- "upkeep": [
+ "base_upkeep": [
1.0,
- 1.0,
- 1.0
+ 0.75,
+ 0.5
]
},
{
"name": "follower",
- "upkeep": [
- 1.0,
+ "base_upkeep": [
1.0,
- 1.0
+ 0.75,
+ 0.5
]
},
{
- "name": "defensive",
- "upkeep": [
- 1.0,
+ "name": "friendly fire",
+ "base_upkeep": [
1.0,
- 1.0
+ 0.75,
+ 0.5
]
},
{
"name": "kamikaze",
- "upkeep": [
+ "base_upkeep": [
1.0,
- 1.0,
- 1.0
+ 0.75,
+ 0.5
]
},
{
"name": "run and gun",
- "upkeep": [
- 1.0,
+ "base_upkeep": [
1.0,
- 1.0
+ 0.75,
+ 0.5
]
},
{
"name": "flank",
- "upkeep": [
- 1.0,
+ "base_upkeep": [
1.0,
- 1.0
+ 0.75,
+ 0.5
]
}
] \ No newline at end of file
diff --git a/build/content/chassis.txt b/build/content/chassis.txt
index 5d8db88..e097f4e 100644
--- a/build/content/chassis.txt
+++ b/build/content/chassis.txt
@@ -1,37 +1,37 @@
[
{
"name": "light two legged bot",
- "slot_weapon": [
+ "base_slot_weapon": [
1.0,
1.0,
1.0
],
- "slot_armor": [
+ "base_slot_armor": [
0.0,
0.0,
0.0
],
- "slot_aug": [
+ "base_slot_aug": [
1.0,
1.0,
1.0
],
- "weight_max": [
+ "base_weight_max": [
20.0,
- 20.0,
- 20.0
+ 25.0,
+ 30.0
],
- "hp": [
+ "base_hp": [
100.0,
- 100.0,
- 100.0
+ 125.0,
+ 150.0
],
- "speed": [
+ "base_speed": [
1.5,
- 1.5,
- 1.5
+ 1.875,
+ 2.25
],
- "upkeep": [
+ "base_upkeep": [
1.0,
1.0,
1.0
@@ -39,268 +39,268 @@
},
{
"name": "heavy two legged bot",
- "slot_weapon": [
+ "base_slot_weapon": [
1.0,
1.0,
1.0
],
- "slot_armor": [
+ "base_slot_armor": [
1.0,
1.0,
1.0
],
- "slot_aug": [
+ "base_slot_aug": [
3.0,
3.0,
3.0
],
- "weight_max": [
+ "base_weight_max": [
45.0,
- 45.0,
- 45.0
+ 56.25,
+ 67.5
],
- "hp": [
+ "base_hp": [
350.0,
- 350.0,
- 350.0
+ 437.5,
+ 525.0
],
- "speed": [
- 1.0,
+ "base_speed": [
1.0,
- 1.0
+ 1.25,
+ 1.5
]
},
{
"name": "light four legged bot",
- "slot_weapon": [
+ "base_slot_weapon": [
2.0,
2.0,
2.0
],
- "slot_armor": [
+ "base_slot_armor": [
1.0,
1.0,
1.0
],
- "slot_aug": [
+ "base_slot_aug": [
2.0,
2.0,
2.0
],
- "weight_max": [
+ "base_weight_max": [
50.0,
- 50.0,
- 50.0
+ 62.5,
+ 75.0
],
- "hp": [
- 400.0,
+ "base_hp": [
400.0,
- 400.0
+ 500.0,
+ 600.0
],
- "speed": [
- 1.0,
+ "base_speed": [
1.0,
- 1.0
+ 1.25,
+ 1.5
]
},
{
"name": "heavy four legged bot",
- "slot_weapon": [
+ "base_slot_weapon": [
2.0,
2.0,
2.0
],
- "slot_armor": [
+ "base_slot_armor": [
2.0,
2.0,
2.0
],
- "slot_aug": [
+ "base_slot_aug": [
5.0,
5.0,
5.0
],
- "weight_max": [
+ "base_weight_max": [
150.0,
- 150.0,
- 150.0
+ 187.5,
+ 225.0
],
- "hp": [
+ "base_hp": [
1200.0,
- 1200.0,
- 1200.0
+ 1500.0,
+ 1800.0
],
- "speed": [
+ "base_speed": [
0.67,
- 0.67,
- 0.67
+ 0.8375,
+ 1.0050000000000001
]
},
{
"name": "light six legged bot",
- "slot_weapon": [
+ "base_slot_weapon": [
2.0,
2.0,
2.0
],
- "slot_armor": [
+ "base_slot_armor": [
2.0,
2.0,
2.0
],
- "slot_aug": [
+ "base_slot_aug": [
3.0,
3.0,
3.0
],
- "weight_max": [
- 210.0,
+ "base_weight_max": [
210.0,
- 210.0
+ 262.5,
+ 315.0
],
- "hp": [
+ "base_hp": [
640.0,
- 640.0,
- 640.0
+ 800.0,
+ 960.0
],
- "speed": [
- 1.0,
+ "base_speed": [
1.0,
- 1.0
+ 1.25,
+ 1.5
]
},
{
"name": "heavy six legged bot",
- "slot_weapon": [
+ "base_slot_weapon": [
2.0,
2.0,
2.0
],
- "slot_armor": [
+ "base_slot_armor": [
4.0,
4.0,
4.0
],
- "slot_aug": [
+ "base_slot_aug": [
6.0,
6.0,
6.0
],
- "weight_max": [
+ "base_weight_max": [
300.0,
- 300.0,
- 300.0
+ 375.0,
+ 450.0
],
- "hp": [
+ "base_hp": [
1500.0,
- 1500.0,
- 1500.0
+ 1875.0,
+ 2250.0
],
- "speed": [
- 1.0,
+ "base_speed": [
1.0,
- 1.0
+ 1.25,
+ 1.5
]
},
{
"name": "light buggy",
- "slot_weapon": [
+ "base_slot_weapon": [
1.0,
1.0,
1.0
],
- "slot_armor": [
+ "base_slot_armor": [
1.0,
1.0,
1.0
],
- "slot_aug": [
+ "base_slot_aug": [
1.0,
1.0,
1.0
],
- "weight_max": [
+ "base_weight_max": [
50.0,
- 50.0,
- 50.0
+ 62.5,
+ 75.0
],
- "hp": [
- 200.0,
+ "base_hp": [
200.0,
- 200.0
+ 250.0,
+ 300.0
],
- "speed": [
- 1.0,
+ "base_speed": [
1.0,
- 1.0
+ 1.25,
+ 1.5
]
},
{
"name": "buggy",
- "slot_weapon": [
+ "base_slot_weapon": [
2.0,
2.0,
2.0
],
- "slot_armor": [
+ "base_slot_armor": [
2.0,
2.0,
2.0
],
- "slot_aug": [
+ "base_slot_aug": [
2.0,
2.0,
2.0
],
- "weight_max": [
+ "base_weight_max": [
150.0,
- 150.0,
- 150.0
+ 187.5,
+ 225.0
],
- "hp": [
+ "base_hp": [
400.0,
- 400.0,
- 400.0
+ 500.0,
+ 600.0
],
- "speed": [
+ "base_speed": [
1.0,
- 1.0,
- 1.0
+ 1.25,
+ 1.5
]
},
{
"name": "light wheeled vehicle",
- "slot_weapon": [
+ "base_slot_weapon": [
1.0,
1.0,
1.0
],
- "slot_armor": [
+ "base_slot_armor": [
0.0,
0.0,
0.0
],
- "slot_aug": [
+ "base_slot_aug": [
2.0,
2.0,
2.0
],
- "weight_max": [
- 60.0,
+ "base_weight_max": [
60.0,
- 60.0
+ 75.0,
+ 90.0
],
- "hp": [
- 320.0,
+ "base_hp": [
320.0,
- 320.0
+ 400.0,
+ 480.0
],
- "speed": [
- 1.0,
+ "base_speed": [
1.0,
- 1.0
+ 1.25,
+ 1.5
],
- "recharge": [
+ "base_recharge": [
0.3,
0.3,
0.3
@@ -308,37 +308,37 @@
},
{
"name": "medium wheeled vehicle",
- "slot_weapon": [
+ "base_slot_weapon": [
2.0,
2.0,
2.0
],
- "slot_armor": [
+ "base_slot_armor": [
2.0,
2.0,
2.0
],
- "slot_aug": [
+ "base_slot_aug": [
3.0,
3.0,
3.0
],
- "weight_max": [
+ "base_weight_max": [
200.0,
- 200.0,
- 200.0
+ 250.0,
+ 300.0
],
- "hp": [
+ "base_hp": [
720.0,
- 720.0,
- 720.0
+ 900.0,
+ 1080.0
],
- "speed": [
- 1.0,
+ "base_speed": [
1.0,
- 1.0
+ 1.25,
+ 1.5
],
- "recharge": [
+ "base_recharge": [
0.2,
0.2,
0.2
@@ -346,37 +346,37 @@
},
{
"name": "heavy wheeled vehicle",
- "slot_weapon": [
+ "base_slot_weapon": [
2.0,
2.0,
2.0
],
- "slot_armor": [
+ "base_slot_armor": [
4.0,
4.0,
4.0
],
- "slot_aug": [
+ "base_slot_aug": [
4.0,
4.0,
4.0
],
- "weight_max": [
- 270.0,
+ "base_weight_max": [
270.0,
- 270.0
+ 337.5,
+ 405.0
],
- "hp": [
+ "base_hp": [
950.0,
- 950.0,
- 950.0
+ 1187.5,
+ 1425.0
],
- "speed": [
- 1.0,
+ "base_speed": [
1.0,
- 1.0
+ 1.25,
+ 1.5
],
- "recharge": [
+ "base_recharge": [
0.2,
0.2,
0.2
@@ -384,37 +384,37 @@
},
{
"name": "light tank",
- "slot_weapon": [
+ "base_slot_weapon": [
1.0,
1.0,
1.0
],
- "slot_armor": [
+ "base_slot_armor": [
3.0,
3.0,
3.0
],
- "slot_aug": [
+ "base_slot_aug": [
2.0,
2.0,
2.0
],
- "weight_max": [
+ "base_weight_max": [
300.0,
- 300.0,
- 300.0
+ 375.0,
+ 450.0
],
- "hp": [
- 700.0,
+ "base_hp": [
700.0,
- 700.0
+ 875.0,
+ 1050.0
],
- "speed": [
+ "base_speed": [
1.0,
- 1.0,
- 1.0
+ 1.25,
+ 1.5
],
- "recharge": [
+ "base_recharge": [
0.4,
0.4,
0.4
@@ -422,37 +422,37 @@
},
{
"name": "medium tank",
- "slot_weapon": [
+ "base_slot_weapon": [
1.0,
1.0,
1.0
],
- "slot_armor": [
+ "base_slot_armor": [
4.0,
4.0,
4.0
],
- "slot_aug": [
+ "base_slot_aug": [
4.0,
4.0,
4.0
],
- "weight_max": [
- 400.0,
+ "base_weight_max": [
400.0,
- 400.0
+ 500.0,
+ 600.0
],
- "hp": [
- 1250.0,
+ "base_hp": [
1250.0,
- 1250.0
+ 1562.5,
+ 1875.0
],
- "speed": [
+ "base_speed": [
1.0,
- 1.0,
- 1.0
+ 1.25,
+ 1.5
],
- "recharge": [
+ "base_recharge": [
0.5,
0.5,
0.5
@@ -460,103 +460,103 @@
},
{
"name": "heavy tank",
- "slot_weapon": [
+ "base_slot_weapon": [
2.0,
2.0,
2.0
],
- "slot_armor": [
+ "base_slot_armor": [
5.0,
5.0,
5.0
],
- "slot_aug": [
+ "base_slot_aug": [
5.0,
5.0,
5.0
],
- "weight_max": [
- 450.0,
+ "base_weight_max": [
450.0,
- 450.0
+ 562.5,
+ 675.0
],
- "hp": [
- 1600.0,
+ "base_hp": [
1600.0,
- 1600.0
+ 2000.0,
+ 2400.0
],
- "speed": [
- 1.0,
+ "base_speed": [
1.0,
- 1.0
+ 1.25,
+ 1.5
]
},
{
"name": "super heavy tank",
- "slot_weapon": [
+ "base_slot_weapon": [
3.0,
3.0,
3.0
],
- "slot_armor": [
+ "base_slot_armor": [
6.0,
6.0,
6.0
],
- "slot_aug": [
+ "base_slot_aug": [
6.0,
6.0,
6.0
],
- "weight_max": [
+ "base_weight_max": [
500.0,
- 500.0,
- 500.0
+ 625.0,
+ 750.0
],
- "hp": [
+ "base_hp": [
2000.0,
- 2000.0,
- 2000.0
+ 2500.0,
+ 3000.0
],
- "speed": [
- 1.0,
+ "base_speed": [
1.0,
- 1.0
+ 1.25,
+ 1.5
]
},
{
"name": "hovercraft",
- "slot_weapon": [
+ "base_slot_weapon": [
2.0,
2.0,
2.0
],
- "slot_armor": [
+ "base_slot_armor": [
0.0,
0.0,
0.0
],
- "slot_aug": [
+ "base_slot_aug": [
3.0,
3.0,
3.0
],
- "weight_max": [
- 40.0,
+ "base_weight_max": [
40.0,
- 40.0
+ 50.0,
+ 60.0
],
- "hp": [
+ "base_hp": [
300.0,
- 300.0,
- 300.0
+ 375.0,
+ 450.0
],
- "speed": [
- 1.0,
+ "base_speed": [
1.0,
- 1.0
+ 1.25,
+ 1.5
],
- "recharge": [
+ "base_recharge": [
-0.2,
-0.2,
-0.2
@@ -564,103 +564,103 @@
},
{
"name": "jet floater",
- "slot_weapon": [
+ "base_slot_weapon": [
1.0,
1.0,
1.0
],
- "slot_armor": [
+ "base_slot_armor": [
0.0,
0.0,
0.0
],
- "slot_aug": [
+ "base_slot_aug": [
2.0,
2.0,
2.0
],
- "weight_max": [
+ "base_weight_max": [
30.0,
- 30.0,
- 30.0
+ 37.5,
+ 45.0
],
- "hp": [
- 60.0,
+ "base_hp": [
60.0,
- 60.0
+ 75.0,
+ 90.0
],
- "speed": [
- 1.0,
+ "base_speed": [
1.0,
- 1.0
+ 1.25,
+ 1.5
]
},
{
"name": "one wheeler",
- "slot_weapon": [
+ "base_slot_weapon": [
1.0,
1.0,
1.0
],
- "slot_armor": [
+ "base_slot_armor": [
0.0,
0.0,
0.0
],
- "slot_aug": [
+ "base_slot_aug": [
4.0,
4.0,
4.0
],
- "weight_max": [
- 15.0,
+ "base_weight_max": [
15.0,
- 15.0
+ 18.75,
+ 22.5
],
- "hp": [
+ "base_hp": [
40.0,
- 40.0,
- 40.0
+ 50.0,
+ 60.0
],
- "speed": [
- 1.0,
+ "base_speed": [
1.0,
- 1.0
+ 1.25,
+ 1.5
]
},
{
"name": "armored crawler",
- "slot_weapon": [
+ "base_slot_weapon": [
1.0,
1.0,
1.0
],
- "slot_armor": [
+ "base_slot_armor": [
4.0,
4.0,
4.0
],
- "slot_aug": [
+ "base_slot_aug": [
2.0,
2.0,
2.0
],
- "weight_max": [
+ "base_weight_max": [
200.0,
- 200.0,
- 200.0
+ 250.0,
+ 300.0
],
- "hp": [
+ "base_hp": [
750.0,
- 750.0,
- 750.0
+ 937.5,
+ 1125.0
],
- "speed": [
+ "base_speed": [
1.0,
- 1.0,
- 1.0
+ 1.25,
+ 1.5
],
- "upkeep": [
+ "base_upkeep": [
0.4,
0.4,
0.4
diff --git a/build/content/coso.py b/build/content/coso.py
new file mode 100644
index 0000000..e68d89d
--- /dev/null
+++ b/build/content/coso.py
@@ -0,0 +1,154 @@
+import json
+
+def vectorize (obj, forbidlist, _):
+ for c in obj:
+ for key in c:
+ if not(key in forbidlist):
+ val = c[key]
+ try: val = int(val);
+ except: pass
+ try: val = float(val);
+ except: pass
+ c[key] = [val for i in range(3)]
+ return obj
+
+def query (obj, allowlist, op):
+ for c in obj:
+ for key in c:
+ if key in allowlist:
+ c[key] = op(c[key])
+ return obj
+
+def update (obj, forbidlist, op):
+ return op(obj)
+
+def select (obj, allowlist, op):
+ l = []
+ for c in obj:
+ for key in c:
+ if key in allowlist:
+ l += [c]
+ return l
+
+
+def comp(filename, l, fun, op=None, rewrite=None):
+ with open(filename+".txt", "r") as f: obj = json.loads(f.read())
+ nobj = fun(obj, l, op)
+ if rewrite is None:
+ with open(filename+".txt", "w") as f:
+ f.write(json.dumps(nobj, indent=4))
+ return nobj
+
+def change_values():
+ amt = .5
+ perc_inc = lambda x: [x[0]*(1.0+(i/2.0)*amt) for i in range(3)]
+ perc_dec = lambda x: [x[0]*(1.0-(i/2.0)*amt) for i in range(3)]
+
+ comp("weapons", ["damage"], query, perc_inc)
+ comp("weapons", ["cooldown"], query, perc_dec)
+ comp("weapons", ["weight"], query, perc_dec)
+ comp("weapons", ["range"], query, perc_inc)
+
+ comp("armor", ["weight"], query, perc_dec)
+ comp("armor", ["pierce"], query, perc_inc)
+ comp("armor", ["spread"], query, perc_inc)
+ comp("armor", ["fusion"], query, perc_inc)
+ comp("armor", ["explosive"], query, perc_inc)
+ comp("armor", ["laser"], query, perc_inc)
+ comp("armor", ["emp"], query, perc_inc)
+ comp("armor", ["impact"], query, perc_inc)
+
+ comp("batteries", ["weight"], query, perc_dec)
+ comp("batteries", ["capacity"], query, perc_inc)
+
+ comp("chassis", ["weight"], query, perc_dec)
+ comp("chassis", ["weight_max"], query, perc_inc)
+ comp("chassis", ["hp"], query, perc_inc)
+ comp("chassis", ["speed"], query, perc_inc)
+
+ comp("brains", ["upkeep"], query, perc_dec)
+
+ comp("augments", ["weight"], query, perc_inc)
+ comp("augments", ["damage_pierce"], query, perc_inc)
+ comp("augments", ["damage_spread"], query, perc_inc)
+ comp("augments", ["damage_fusion"], query, perc_inc)
+ comp("augments", ["damage_explosive"], query, perc_inc)
+ comp("augments", ["damage_laser"], query, perc_inc)
+ comp("augments", ["damage_emp"], query, perc_inc)
+ comp("augments", ["damage_impact"], query, perc_inc)
+ comp("augments", ["armor_pierce"], query, perc_inc)
+ comp("augments", ["armor_spread"], query, perc_inc)
+ comp("augments", ["armor_fusion"], query, perc_inc)
+ comp("augments", ["armor_explosive"], query, perc_inc)
+ comp("augments", ["armor_laser"], query, perc_inc)
+ comp("augments", ["armor_emp"], query, perc_inc)
+ comp("augments", ["armor_impact"], query, perc_inc)
+ comp("augments", ["add_range"], query, perc_inc)
+ comp("augments", ["add_cooldown"], query, perc_inc)
+ comp("augments", ["recharge"], query, perc_inc)
+ comp("augments", ["add_hp"], query, perc_inc)
+
+def get_data ():
+ # static data analysis, compute image
+ get_first = lambda x: x
+ xsc = comp("weapons", ["damage"], select, get_first, False)
+ if len(xsc) < 2: pygame.quit(); return
+ wstep = 200
+ w = len(xsc)*wstep
+ hmax = 512
+ xs = [x["damage"][0]/x["cooldown"][0]*x["weight"][0]*x["range"][0] for x in xsc]
+ maxx = max(xs); minx = min(xs)
+
+ import pygame
+ pygame.init()
+ pygame.display.set_mode((20, 20))
+ size = (w, hmax)
+ scr = pygame.Surface((size[0], size[1]+15)).convert_alpha()
+ scr.fill((0,0,0))
+ font = pygame.font.SysFont("Courier New", 10)
+
+ for i in range(len(xs)):
+ x = xs[i]
+ h = (x-minx)/(maxx-minx) *size[1]
+ rect = wstep*i, 15+size[1]-h, wstep, h
+ pygame.draw.rect(scr, (255,255,255), rect)
+ txt = font.render(xsc[i]["name"], True, (255,255,255))
+ scr.blit(txt, (rect[0], rect[1]-12))
+ pygame.image.save(scr, "__results.png")
+ pygame.quit()
+
+if __name__ == "__main__":
+ try:
+ #comp("weapons", ["name", "damage_type"])
+ #comp("augments", ["name"])
+ #comp("batteries", ["name"])
+ #comp("armor", ["name"])
+ #comp("chassis", ["name"])
+ #comp("brains", ["name"])
+
+ #change_values()
+
+ #get_data();
+
+
+ forbidlist = ["name"]
+ def rename (obj):
+ nobj = []
+ for d in obj:
+ nd = {}
+ for (key, value) in d.items():
+ if not(key in forbidlist): nd["base_"+key] = value
+ else: nd[key] = value
+ nobj += [nd]
+ return nobj
+ #comp("chassis", ["name"], update, rename)
+ comp("weapons", ["name"], update, rename)
+ comp("augments", ["name"], update, rename)
+ comp("batteries", ["name"], update, rename)
+ comp("brains", ["name"], update, rename)
+ comp("armor", ["name"], update, rename)
+
+ except:
+ import traceback
+ traceback.print_exc()
+ input()
diff --git a/build/content/templates/default.txt b/build/content/templates/default.txt
index a57fce5..88db0c8 100644
--- a/build/content/templates/default.txt
+++ b/build/content/templates/default.txt
@@ -7,7 +7,7 @@
"weapons": [ -1, -1, -1, -1, -1, -1, -1, -1 ],
"armor": [ -1, -1, -1, -1, -1, -1, -1, -1 ],
"augs": [ 4, -1, -1, -1, -1, -1, -1, -1 ],
- "levels": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
+ "levels": [ 0, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
},
{
"name": "raw",
@@ -107,6 +107,6 @@
"weapons": [ 0, 2, -1, -1, -1, -1, -1, -1 ],
"armor": [ 1, 0, 1, -1, 3, -1, -1, -1 ],
"augs": [ 1, -1, 2, -1, 0, -1, -1, -1 ],
- "levels": [ 0, 1, 2, 2, 2, 0, 0, 0, 0, 0, 0, 2, 1, 1, 0, 2, 0, 0, 0, 2, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
+ "levels": [ 0, 1, 2, 0, 2, 0, 0, 0, 0, 0, 0, 2, 1, 1, 0, 2, 0, 0, 0, 2, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
}
] \ No newline at end of file
diff --git a/build/content/weapons.txt b/build/content/weapons.txt
index 324b66a..61fda30 100644
--- a/build/content/weapons.txt
+++ b/build/content/weapons.txt
@@ -1,244 +1,234 @@
[
{
"name": "smg",
- "damage_type": "pierce",
- "weight": [
+ "base_weight": [
10.0,
- 10.0,
- 10.0
+ 7.5,
+ 5.0
],
- "cooldown": [
- 1.0,
+ "base_weapon_cooldown": [
1.0,
- 1.0
+ 0.75,
+ 0.5
],
- "damage": [
+ "base_weapon_damage_pierce": [
10.0,
12.5,
15.0
],
- "range": [
- 4.0,
+ "base_weapon_range": [
4.0,
- 4.0
+ 5.0,
+ 6.0
]
},
{
"name": "machinegun",
- "damage_type": "pierce",
- "weight": [
- 25.0,
+ "base_weight": [
25.0,
- 25.0
+ 18.75,
+ 12.5
],
- "cooldown": [
- 1.0,
+ "base_weapon_cooldown": [
1.0,
- 1.0
+ 0.75,
+ 0.5
],
- "damage": [
+ "base_weapon_damage_pierce": [
15.0,
18.75,
22.5
],
- "range": [
- 5.0,
+ "base_weapon_range": [
5.0,
- 5.0
+ 6.25,
+ 7.5
]
},
{
"name": "heavy machinegun",
- "damage_type": "pierce",
- "weight": [
- 40.0,
+ "base_weight": [
40.0,
- 40.0
+ 30.0,
+ 20.0
],
- "cooldown": [
- 1.0,
+ "base_weapon_cooldown": [
1.0,
- 1.0
+ 0.75,
+ 0.5
],
- "damage": [
+ "base_weapon_damage_pierce": [
20.0,
25.0,
30.0
],
- "range": [
+ "base_weapon_range": [
5.0,
- 5.0,
- 5.0
+ 6.25,
+ 7.5
]
},
{
"name": "semi autocannon",
- "damage_type": "pierce",
- "weight": [
+ "base_weight": [
70.0,
- 70.0,
- 70.0
+ 52.5,
+ 35.0
],
- "cooldown": [
- 2.0,
+ "base_weapon_cooldown": [
2.0,
- 2.0
+ 1.5,
+ 1.0
],
- "damage": [
+ "base_weapon_damage_pierce": [
32.0,
40.0,
48.0
],
- "range": [
- 6.0,
+ "base_weapon_range": [
6.0,
- 6.0
+ 7.5,
+ 9.0
]
},
{
"name": "autocannon",
- "damage_type": "pierce",
- "weight": [
+ "base_weight": [
100.0,
- 100.0,
- 100.0
+ 75.0,
+ 50.0
],
- "cooldown": [
+ "base_weapon_cooldown": [
1.0,
- 1.0,
- 1.0
+ 0.75,
+ 0.5
],
- "damage": [
+ "base_weapon_damage_pierce": [
40.0,
50.0,
60.0
],
- "range": [
+ "base_weapon_range": [
6.0,
- 6.0,
- 6.0
+ 7.5,
+ 9.0
]
},
{
"name": "high velocity cannon",
- "damage_type": "pierce",
- "weight": [
- 120.0,
+ "base_weight": [
120.0,
- 120.0
+ 90.0,
+ 60.0
],
- "cooldown": [
+ "base_weapon_cooldown": [
4.0,
- 4.0,
- 4.0
+ 3.0,
+ 2.0
],
- "damage": [
+ "base_weapon_damage_pierce": [
250.0,
312.5,
375.0
],
- "range": [
- 7.0,
+ "base_weapon_range": [
7.0,
- 7.0
+ 8.75,
+ 10.5
]
},
{
"name": "scrap gun",
- "damage_type": "spread",
- "weight": [
- 5.0,
+ "base_weight": [
5.0,
- 5.0
+ 3.75,
+ 2.5
],
- "cooldown": [
- 2.0,
+ "base_weapon_cooldown": [
2.0,
- 2.0
+ 1.5,
+ 1.0
],
- "damage": [
+ "base_weapon_damage_spread": [
8.0,
10.0,
12.0
],
- "range": [
+ "base_weapon_range": [
3.0,
- 3.0,
- 3.0
+ 3.75,
+ 4.5
]
},
{
"name": "burst cannon",
- "damage_type": "spread",
- "weight": [
+ "base_weight": [
15.0,
- 15.0,
- 15.0
+ 11.25,
+ 7.5
],
- "cooldown": [
- 2.0,
+ "base_weapon_cooldown": [
2.0,
- 2.0
+ 1.5,
+ 1.0
],
- "damage": [
+ "base_weapon_damage_spread": [
25.0,
31.25,
37.5
],
- "range": [
+ "base_weapon_range": [
4.0,
- 4.0,
- 4.0
+ 5.0,
+ 6.0
]
},
{
"name": "heavy burst cannon",
- "damage_type": "spread",
- "weight": [
- 30.0,
+ "base_weight": [
30.0,
- 30.0
+ 22.5,
+ 15.0
],
- "cooldown": [
- 2.0,
+ "base_weapon_cooldown": [
2.0,
- 2.0
+ 1.5,
+ 1.0
],
- "damage": [
+ "base_weapon_damage_spread": [
40.0,
50.0,
60.0
],
- "range": [
+ "base_weapon_range": [
5.0,
- 5.0,
- 5.0
+ 6.25,
+ 7.5
]
},
{
"name": "maul",
- "damage_type": "impact",
- "weight": [
+ "base_weight": [
200.0,
- 200.0,
- 200.0
+ 150.0,
+ 100.0
],
- "cooldown": [
- 3.0,
+ "base_weapon_cooldown": [
3.0,
- 3.0
+ 2.25,
+ 1.5
],
- "damage": [
+ "base_weapon_damage_impact": [
400.0,
500.0,
600.0
],
- "range": [
+ "base_weapon_range": [
1.0,
- 1.0,
- 1.0
+ 1.25,
+ 1.5
],
- "knockback": [
+ "base_weapon_knockback": [
2.0,
2.0,
2.0
@@ -246,52 +236,50 @@
},
{
"name": "slam",
- "damage_type": "impact",
- "weight": [
+ "base_weight": [
0.0,
0.0,
0.0
],
- "cooldown": [
+ "base_weapon_cooldown": [
1.0,
- 1.0,
- 1.0
+ 0.75,
+ 0.5
],
- "damage": [
+ "base_weapon_damage_impact": [
6.0,
7.5,
9.0
],
- "range": [
- 1.0,
+ "base_weapon_range": [
1.0,
- 1.0
+ 1.25,
+ 1.5
]
},
{
"name": "warhammer",
- "damage_type": "impact",
- "weight": [
- 40.0,
+ "base_weight": [
40.0,
- 40.0
+ 30.0,
+ 20.0
],
- "cooldown": [
+ "base_weapon_cooldown": [
1.0,
- 1.0,
- 1.0
+ 0.75,
+ 0.5
],
- "damage": [
+ "base_weapon_damage_impact": [
60.0,
75.0,
90.0
],
- "range": [
+ "base_weapon_range": [
1.0,
- 1.0,
- 1.0
+ 1.25,
+ 1.5
],
- "knockback": [
+ "base_weapon_knockback": [
1.0,
1.0,
1.0
@@ -299,52 +287,50 @@
},
{
"name": "rocket",
- "damage_type": "explosive",
- "weight": [
+ "base_weight": [
60.0,
- 60.0,
- 60.0
+ 45.0,
+ 30.0
],
- "cooldown": [
- 3.0,
+ "base_weapon_cooldown": [
3.0,
- 3.0
+ 2.25,
+ 1.5
],
- "damage": [
+ "base_weapon_damage_explosive": [
100.0,
125.0,
150.0
],
- "range": [
- 8.0,
+ "base_weapon_range": [
8.0,
- 8.0
+ 10.0,
+ 12.0
]
},
{
"name": "rocket swarm",
- "damage_type": "explosive",
- "weight": [
+ "base_weight": [
120.0,
- 120.0,
- 120.0
+ 90.0,
+ 60.0
],
- "cooldown": [
- 3.0,
+ "base_weapon_cooldown": [
3.0,
- 3.0
+ 2.25,
+ 1.5
],
- "damage": [
+ "base_weapon_damage_explosive": [
60.0,
75.0,
90.0
],
- "range": [
- 7.0,
+ "base_weapon_range": [
7.0,
- 7.0
+ 8.75,
+ 10.5
],
- "aoe": [
+ "base_weapon_aoe": [
2.0,
2.0,
2.0
@@ -352,28 +338,27 @@
},
{
"name": "tactical rocket",
- "damage_type": "explosive",
- "weight": [
+ "base_weight": [
160.0,
- 160.0,
- 160.0
+ 120.0,
+ 80.0
],
- "cooldown": [
- 1.0,
+ "base_weapon_cooldown": [
1.0,
- 1.0
+ 0.75,
+ 0.5
],
- "damage": [
+ "base_weapon_damage_explosive": [
100.0,
125.0,
150.0
],
- "range": [
- 8.0,
+ "base_weapon_range": [
8.0,
- 8.0
+ 10.0,
+ 12.0
],
- "aoe": [
+ "base_weapon_aoe": [
1.0,
1.0,
1.0
@@ -381,28 +366,27 @@
},
{
"name": "nuclear rocket",
- "damage_type": "explosive",
- "weight": [
- 200.0,
+ "base_weight": [
200.0,
- 200.0
+ 150.0,
+ 100.0
],
- "cooldown": [
- 6.0,
+ "base_weapon_cooldown": [
6.0,
- 6.0
+ 4.5,
+ 3.0
],
- "damage": [
+ "base_weapon_damage_explosive": [
300.0,
375.0,
450.0
],
- "range": [
+ "base_weapon_range": [
9.0,
- 9.0,
- 9.0
+ 11.25,
+ 13.5
],
- "aoe": [
+ "base_weapon_aoe": [
3.0,
3.0,
3.0
@@ -410,172 +394,165 @@
},
{
"name": "light laser",
- "damage_type": "laser",
- "weight": [
- 20.0,
+ "base_weight": [
20.0,
- 20.0
+ 15.0,
+ 10.0
],
- "cooldown": [
- 1.0,
+ "base_weapon_cooldown": [
1.0,
- 1.0
+ 0.75,
+ 0.5
],
- "damage": [
+ "base_weapon_damage_laser": [
8.0,
10.0,
12.0
],
- "range": [
- 5.0,
+ "base_weapon_range": [
5.0,
- 5.0
+ 6.25,
+ 7.5
]
},
{
"name": "combined light laser",
- "damage_type": "laser",
- "weight": [
- 50.0,
+ "base_weight": [
50.0,
- 50.0
+ 37.5,
+ 25.0
],
- "cooldown": [
- 1.0,
+ "base_weapon_cooldown": [
1.0,
- 1.0
+ 0.75,
+ 0.5
],
- "damage": [
+ "base_weapon_damage_laser": [
20.0,
25.0,
30.0
],
- "range": [
- 6.0,
+ "base_weapon_range": [
6.0,
- 6.0
+ 7.5,
+ 9.0
]
},
{
"name": "heavy laser",
- "damage_type": "laser",
- "weight": [
- 130.0,
+ "base_weight": [
130.0,
- 130.0
+ 97.5,
+ 65.0
],
- "cooldown": [
- 1.0,
+ "base_weapon_cooldown": [
1.0,
- 1.0
+ 0.75,
+ 0.5
],
- "damage": [
+ "base_weapon_damage_laser": [
45.0,
56.25,
67.5
],
- "range": [
- 6.0,
+ "base_weapon_range": [
6.0,
- 6.0
+ 7.5,
+ 9.0
]
},
{
"name": "combined heavy laser",
- "damage_type": "laser",
- "weight": [
- 300.0,
+ "base_weight": [
300.0,
- 300.0
+ 225.0,
+ 150.0
],
- "cooldown": [
- 1.0,
+ "base_weapon_cooldown": [
1.0,
- 1.0
+ 0.75,
+ 0.5
],
- "damage": [
+ "base_weapon_damage_laser": [
150.0,
187.5,
225.0
],
- "range": [
- 7.0,
+ "base_weapon_range": [
7.0,
- 7.0
+ 8.75,
+ 10.5
]
},
{
"name": "plasma cannon",
- "damage_type": "fusion",
- "weight": [
+ "base_weight": [
80.0,
- 80.0,
- 80.0
+ 60.0,
+ 40.0
],
- "cooldown": [
- 2.0,
+ "base_weapon_cooldown": [
2.0,
- 2.0
+ 1.5,
+ 1.0
],
- "damage": [
+ "base_weapon_damage_fusion": [
125.0,
156.25,
187.5
],
- "range": [
- 5.0,
+ "base_weapon_range": [
5.0,
- 5.0
+ 6.25,
+ 7.5
]
},
{
"name": "plasma autocannon",
- "damage_type": "fusion",
- "weight": [
- 170.0,
+ "base_weight": [
170.0,
- 170.0
+ 127.5,
+ 85.0
],
- "cooldown": [
+ "base_weapon_cooldown": [
1.0,
- 1.0,
- 1.0
+ 0.75,
+ 0.5
],
- "damage": [
+ "base_weapon_damage_fusion": [
110.0,
137.5,
165.0
],
- "range": [
+ "base_weapon_range": [
5.0,
- 5.0,
- 5.0
+ 6.25,
+ 7.5
]
},
{
"name": "plasma artillery",
- "damage_type": "fusion",
- "weight": [
+ "base_weight": [
200.0,
- 200.0,
- 200.0
+ 150.0,
+ 100.0
],
- "cooldown": [
+ "base_weapon_cooldown": [
3.0,
- 3.0,
- 3.0
+ 2.25,
+ 1.5
],
- "damage": [
+ "base_weapon_damage_fusion": [
100.0,
125.0,
150.0
],
- "range": [
+ "base_weapon_range": [
7.0,
- 7.0,
- 7.0
+ 8.75,
+ 10.5
],
- "aoe": [
+ "base_weapon_aoe": [
2.0,
2.0,
2.0
@@ -583,225 +560,216 @@
},
{
"name": "fusion blade",
- "damage_type": "fusion",
- "weight": [
- 15.0,
+ "base_weight": [
15.0,
- 15.0
+ 11.25,
+ 7.5
],
- "cooldown": [
+ "base_weapon_cooldown": [
1.0,
- 1.0,
- 1.0
+ 0.75,
+ 0.5
],
- "damage": [
+ "base_weapon_damage_fusion": [
15.0,
18.75,
22.5
],
- "range": [
+ "base_weapon_range": [
1.0,
- 1.0,
- 1.0
+ 1.25,
+ 1.5
]
},
{
"name": "fusion lance",
- "damage_type": "fusion",
- "weight": [
- 50.0,
+ "base_weight": [
50.0,
- 50.0
+ 37.5,
+ 25.0
],
- "cooldown": [
+ "base_weapon_cooldown": [
1.0,
- 1.0,
- 1.0
+ 0.75,
+ 0.5
],
- "damage": [
+ "base_weapon_damage_fusion": [
45.0,
56.25,
67.5
],
- "range": [
+ "base_weapon_range": [
2.0,
- 2.0,
- 2.0
+ 2.5,
+ 3.0
]
},
{
"name": "light railgun",
- "damage_type": "impact",
- "weight": [
- 50.0,
+ "base_weight": [
50.0,
- 50.0
+ 37.5,
+ 25.0
],
- "cooldown": [
- 2.0,
+ "base_weapon_cooldown": [
2.0,
- 2.0
+ 1.5,
+ 1.0
],
- "damage": [
+ "base_weapon_damage_impact": [
90.0,
112.5,
135.0
],
- "range": [
- 6.0,
+ "base_weapon_range": [
6.0,
- 6.0
+ 7.5,
+ 9.0
]
},
{
"name": "heavy railgun",
- "damage_type": "impact",
- "weight": [
- 190.0,
+ "base_weight": [
190.0,
- 190.0
+ 142.5,
+ 95.0
],
- "cooldown": [
- 3.0,
+ "base_weapon_cooldown": [
3.0,
- 3.0
+ 2.25,
+ 1.5
],
- "damage": [
+ "base_weapon_damage_impact": [
450.0,
562.5,
675.0
],
- "range": [
- 7.0,
+ "base_weapon_range": [
7.0,
- 7.0
+ 8.75,
+ 10.5
]
},
{
"name": "supercharged railgun",
- "damage_type": "impact",
- "weight": [
+ "base_weight": [
240.0,
- 240.0,
- 240.0
+ 180.0,
+ 120.0
],
- "cooldown": [
+ "base_weapon_cooldown": [
4.0,
- 4.0,
- 4.0
+ 3.0,
+ 2.0
],
- "damage": [
+ "base_weapon_damage_impact": [
1000.0,
1250.0,
1500.0
],
- "range": [
- 8.0,
+ "base_weapon_range": [
8.0,
- 8.0
+ 10.0,
+ 12.0
]
},
{
"name": "discharge beam",
- "damage_type": "emp",
- "weight": [
- 40.0,
+ "base_weight": [
40.0,
- 40.0
+ 30.0,
+ 20.0
],
- "cooldown": [
- 2.0,
+ "base_weapon_cooldown": [
2.0,
- 2.0
+ 1.5,
+ 1.0
],
- "damage_battery": [
+ "base_weapon_damage_battery": [
3.0,
3.0,
3.0
],
- "range": [
- 4.0,
+ "base_weapon_range": [
4.0,
- 4.0
+ 5.0,
+ 6.0
]
},
{
"name": "haywire beam",
- "damage_type": "emp",
- "weight": [
+ "base_weight": [
50.0,
- 50.0,
- 50.0
+ 37.5,
+ 25.0
],
- "cooldown": [
- 5.0,
+ "base_weapon_cooldown": [
5.0,
- 5.0
+ 3.75,
+ 2.5
],
- "damage": [
+ "base_weapon_damage_emp": [
80.0,
100.0,
120.0
],
- "damage_battery": [
+ "base_weapon_damage_battery": [
5.0,
5.0,
5.0
],
- "range": [
- 6.0,
+ "base_weapon_range": [
6.0,
- 6.0
+ 7.5,
+ 9.0
]
},
{
"name": "stun beam",
- "damage_type": "emp",
- "weight": [
+ "base_weight": [
80.0,
- 80.0,
- 80.0
+ 60.0,
+ 40.0
],
- "cooldown": [
- 5.0,
+ "base_weapon_cooldown": [
5.0,
- 5.0
+ 3.75,
+ 2.5
],
- "stun": [
+ "base_weapon_stun": [
1.0,
1.0,
1.0
],
- "range": [
- 4.0,
+ "base_weapon_range": [
4.0,
- 4.0
+ 5.0,
+ 6.0
]
},
{
"name": "amplified discharge impulse",
- "damage_type": "emp",
- "weight": [
- 150.0,
+ "base_weight": [
150.0,
- 150.0
+ 112.5,
+ 75.0
],
- "cooldown": [
- 3.0,
+ "base_weapon_cooldown": [
3.0,
- 3.0
+ 2.25,
+ 1.5
],
- "damage_battery": [
+ "base_weapon_damage_battery": [
10.0,
10.0,
10.0
],
- "range": [
- 5.0,
+ "base_weapon_range": [
5.0,
- 5.0
+ 6.25,
+ 7.5
],
- "aoe": [
+ "base_weapon_aoe": [
1.0,
1.0,
1.0
@@ -809,139 +777,134 @@
},
{
"name": "amplified haywire beam",
- "damage_type": "emp",
- "weight": [
+ "base_weight": [
120.0,
- 120.0,
- 120.0
+ 90.0,
+ 60.0
],
- "cooldown": [
+ "base_weapon_cooldown": [
5.0,
- 5.0,
- 5.0
+ 3.75,
+ 2.5
],
- "damage": [
+ "base_weapon_damage_emp": [
200.0,
250.0,
300.0
],
- "damage_battery": [
+ "base_weapon_damage_battery": [
12.0,
12.0,
12.0
],
- "range": [
+ "base_weapon_range": [
6.0,
- 6.0,
- 6.0
+ 7.5,
+ 9.0
]
},
{
"name": "amplified stun beam",
- "damage_type": "emp",
- "weight": [
- 200.0,
+ "base_weight": [
200.0,
- 200.0
+ 150.0,
+ 100.0
],
- "cooldown": [
+ "base_weapon_cooldown": [
6.0,
- 6.0,
- 6.0
+ 4.5,
+ 3.0
],
- "stun": [
+ "base_weapon_stun": [
1.0,
1.0,
1.0
],
- "range": [
- 4.0,
+ "base_weapon_range": [
4.0,
- 4.0
+ 5.0,
+ 6.0
]
},
{
"name": "ion cannon",
- "damage_type": "emp",
- "weight": [
- 75.0,
+ "base_weight": [
75.0,
- 75.0
+ 56.25,
+ 37.5
],
- "cooldown": [
+ "base_weapon_cooldown": [
2.0,
- 2.0,
- 2.0
+ 1.5,
+ 1.0
],
- "reduce_fusion": [
+ "base_weapon_reduce_fusion": [
1.0,
1.0,
1.0
],
- "reduce_laser": [
+ "base_weapon_reduce_laser": [
1.0,
1.0,
1.0
],
- "range": [
- 5.0,
+ "base_weapon_range": [
5.0,
- 5.0
+ 6.25,
+ 7.5
]
},
{
"name": "heavy ion cannon",
- "damage_type": "emp",
- "weight": [
+ "base_weight": [
150.0,
- 150.0,
- 150.0
+ 112.5,
+ 75.0
],
- "cooldown": [
+ "base_weapon_cooldown": [
1.0,
- 1.0,
- 1.0
+ 0.75,
+ 0.5
],
- "reduce_fusion": [
+ "base_weapon_reduce_fusion": [
1.0,
1.0,
1.0
],
- "reduce_laser": [
+ "base_weapon_reduce_laser": [
1.0,
1.0,
1.0
],
- "range": [
+ "base_weapon_range": [
6.0,
- 6.0,
- 6.0
+ 7.5,
+ 9.0
]
},
{
"name": "explosive charges",
- "damage_type": "explosive",
- "weight": [
- 5.0,
+ "base_weight": [
5.0,
- 5.0
+ 3.75,
+ 2.5
],
- "cooldown": [
- 10.0,
+ "base_weapon_cooldown": [
10.0,
- 10.0
+ 7.5,
+ 5.0
],
- "damage": [
+ "base_weapon_damage_explosive": [
100.0,
125.0,
150.0
],
- "range": [
+ "base_weapon_range": [
0.0,
0.0,
0.0
],
- "aoe": [
+ "base_weapon_aoe": [
2.0,
2.0,
2.0
@@ -949,26 +912,25 @@
},
{
"name": "javelin",
- "damage_type": "explosive",
- "weight": [
- 60.0,
+ "base_weight": [
60.0,
- 60.0
+ 45.0,
+ 30.0
],
- "cooldown": [
+ "base_weapon_cooldown": [
2.0,
- 2.0,
- 2.0
+ 1.5,
+ 1.0
],
- "damage": [
+ "base_weapon_damage_explosive": [
40.0,
50.0,
60.0
],
- "range": [
- 7.0,
+ "base_weapon_range": [
7.0,
- 7.0
+ 8.75,
+ 10.5
]
}
] \ No newline at end of file
diff --git a/build/test.exe b/build/test.exe
index 785d8e1..9182145 100644
--- a/build/test.exe
+++ b/build/test.exe
Binary files differ
diff --git a/design/design.txt b/design/design.txt
index b4ee2fc..667ed7e 100644
--- a/design/design.txt
+++ b/design/design.txt
@@ -1,3 +1,12 @@
+major component redesign:
+every component has a big struct with everything
+when using the unit, condensate every component's struct into one, which is
+used in parallel to the army array
+
+
+
+
+
descript: arena clone + autochess
turn: move+attack
diff --git a/gst/info.c b/gst/info.c
index c12c620..b99bd4a 100644
--- a/gst/info.c
+++ b/gst/info.c
@@ -496,7 +496,7 @@ void info_weapon_parse (char *json, info_weapon *w, jsmntok_t *t, int r,
}
if (strcmp(key, "stun") == 0) {
int rt = json_parse_subtokens(json, t, r, i+1);
- json_parse_array(json, w->stun, t+i+2, rt-1, 'i');
+ json_parse_array(json, w->stun, t+i+2, rt-1, 'f');
i += rt;
}
for (int h=0; h<7; h++) {
@@ -533,7 +533,6 @@ void info_chassis_parse (char *json, info_chassis *c, jsmntok_t *t, int r,
if (strcmp(key, "slot_weapon") == 0) {
int rt = json_parse_subtokens(json, t, r, i+1);
json_parse_array(json, c->slot_weapon, t+i+2, rt-1, 'i');
- printf("%d %d %d\n", c->slot_weapon[0], c->slot_weapon[1], c->slot_weapon[2]);
i += rt;
}
if (strcmp(key, "slot_armor") == 0) {
@@ -732,37 +731,37 @@ void info_parse_json (infos *info, char *json, char *obj) {
if (strcmp(obj, "template") == 0) {
info_unit_parse(json,
info->templates+index, t+i+1, rt, info);
- info->templateslen = index+1;
+ info->templateslen ++;
}
if (strcmp(obj, "weapon") == 0) {
info_weapon_parse(json,
info->weapons+index, t+i+1, rt, info);
- info->weaponslen = index+1;
+ info->weaponslen ++;
}
if (strcmp(obj, "chassis") == 0) {
info_chassis_parse(json,
info->chassis+index, t+i+1, rt, info);
- info->chassislen = index+1;
+ info->chassislen ++;
}
if (strcmp(obj, "battery") == 0) {
info_battery_parse(json,
info->batteries+index, t+i+1, rt, info);
- info->batterieslen = index+1;
+ info->batterieslen ++;
}
if (strcmp(obj, "armor") == 0) {
info_armor_parse(json,
info->armors+index, t+i+1, rt, info);
- info->armorslen = index+1;
+ info->armorslen ++;
}
if (strcmp(obj, "aug") == 0) {
info_aug_parse(json,
info->augs+index, t+i+1, rt, info);
- info->augslen = index+1;
+ info->augslen ++;
}
if (strcmp(obj, "brain") == 0) {
info_brain_parse(json,
info->brains+index, t+i+1, rt, info);
- info->brainslen = index+1;
+ info->brainslen ++;
}
index ++;
i += rt-1;
@@ -770,6 +769,210 @@ void info_parse_json (infos *info, char *json, char *obj) {
}
}
+#define LOOP(x) for (int z=0; z<x; z++)
+
+void stats_weapon_init (stats_weapon *weap) {
+ LOOP(7) weap->damage[z] = 0;
+ weap->cooldown = 0;
+ weap->aoe = 0;
+ weap->knockback = 0;
+ weap->damage_battery = 0;
+ weap->stun = 0;
+ LOOP(7) weap->armor_reduce[z] = 0;
+ weap->charge_per_shot = 0;
+}
+
+void stats_frame_init (stats_frame *frame) {
+ frame->hp = 0;
+ frame->weight = 0;
+ frame->weight_max = 0;
+ frame->slot_weapon = 0;
+ frame->slot_armor = 0;
+ frame->slot_aug = 0;
+ frame->speed = 0;
+ frame->upkeep = 0;
+ frame->capacity = 0;
+ frame->recharge = 0;
+ LOOP(7) frame->armor[z] = 0;
+}
+
+void stats_comp_init (stats_comp *comp) {
+ strcpy(comp->name, "-");
+ strcpy(comp->description, "-");
+ LOOP(MAXLEVEL) {
+ stats_frame_init(comp->base +z);
+ stats_frame_init(comp->perc +z);
+ stats_weapon_init(comp->base_weapon +z);
+ stats_weapon_init(comp->perc_weapon +z);
+ }
+}
+
+#define PRINT(obj, attr, type) { \
+ if (obj->attr != 0) {\
+ printf(" "#attr": %"#type"\n", obj->attr); \
+ }\
+}
+
+void stats_frame_printf (stats_frame *frame) {
+ PRINT(frame, hp, f);
+ PRINT(frame, weight, f);
+ PRINT(frame, weight_max, f);
+ PRINT(frame, slot_weapon, d);
+ PRINT(frame, slot_armor, d);
+ PRINT(frame, slot_aug, d);
+ PRINT(frame, speed, f);
+ PRINT(frame, upkeep, f);
+ PRINT(frame, capacity, f);
+ PRINT(frame, recharge, f);
+ LOOP(7) PRINT(frame, armor[z], f);
+}
+
+void stats_weapon_printf (stats_weapon *weap) {
+ LOOP(7) PRINT(weap, damage[z], f);
+ PRINT(weap, cooldown, f);
+ PRINT(weap, aoe, f);
+ PRINT(weap, knockback, f);
+ PRINT(weap, damage_battery, f);
+ PRINT(weap, stun, f);
+ PRINT(weap, charge_per_shot, f);
+ LOOP(7) PRINT(weap, armor_reduce[z], f);
+}
+
+void stats_comp_printf (stats_comp *comp) {
+ printf("name: %s\n", comp->name);
+ printf("description: %s\n", comp->description);
+ LOOP(MAXLEVEL) {
+ printf(" level %d ->\n", z);
+ stats_frame_printf(comp->base +z);
+ stats_frame_printf(comp->perc +z);
+ stats_weapon_printf(comp->base_weapon +z);
+ stats_weapon_printf(comp->perc_weapon +z);
+ }
+}
+
+#define MATCH(frame, attr, type) {\
+ if (strcmp(key, #frame"_"#attr) == 0) {\
+ printf(" matched %s\n", #attr);\
+ int rt = json_parse_subtokens(json, t, r, i+1); \
+ if (type == 'f') {\
+ float v[3]; json_parse_array(json, v, t+i+2, rt-1, type);\
+ LOOP(MAXLEVEL) comp->frame[z].attr = v[z];\
+ } if (type == 'i') {\
+ int v[3]; json_parse_array(json, v, t+i+2, rt-1, type);\
+ LOOP(MAXLEVEL) comp->frame[z].attr = v[z];\
+ }\
+ i += rt;\
+ }\
+}
+
+#define MATCH_ARRAY(frame, attr, attr2, type, num) {\
+ char str[64]; sprintf(str, "%s%s", #frame"_"#attr"_", attr2);\
+ if (strcmp(key, str) == 0) {\
+ printf(" matched\n");\
+ int rt = json_parse_subtokens(json, t, r, i+1); \
+ float v[3]; json_parse_array(json, v, t+i+2, rt-1, type);\
+ LOOP(MAXLEVEL) comp->frame[z].attr[num] = v[z];\
+ i += rt;\
+ }\
+}
+
+/* REMOVE AFTER THIS */ #include <conio.h>
+
+void stats_comp_parse (char *json, stats_comp *comp, jsmntok_t *t, int r,
+ infos *info)
+{
+ stats_comp_init(comp);
+ int obj_i = 0, dict_i = -1;
+ for (int i=0; i<r; i+=1) {
+ if (t[i].type == JSMN_STRING) {
+ char key[32]; substr_token(json, key, t+i);
+ if (strcmp(key, "name") == 0) {
+ substr_token(json, comp->name, t+i+1); i++;
+ }
+ if (strcmp(key, "description") == 0) {
+ substr_token(json, comp->description, t+i+1); i++;
+ }
+
+ MATCH(base, hp, 'f');
+ MATCH(base, weight, 'f');
+ MATCH(base, weight_max, 'f');
+ MATCH(base, slot_weapon, 'i');
+ MATCH(base, slot_armor, 'i');
+ MATCH(base, slot_aug, 'i');
+ MATCH(base, speed, 'f');
+ MATCH(base, upkeep, 'f');
+ MATCH(base, capacity, 'f');
+ MATCH(base, recharge, 'f');
+ for (int j=0;j<7; j++) {
+ MATCH_ARRAY(base, armor, info->damage_types[j], 'f', j);
+ }
+
+ MATCH(perc, hp, 'f');
+ MATCH(perc, weight, 'f');
+ MATCH(perc, weight_max, 'f');
+ MATCH(perc, slot_weapon, 'i');
+ MATCH(perc, slot_armor, 'i');
+ MATCH(perc, slot_aug, 'i');
+ MATCH(perc, speed, 'f');
+ MATCH(perc, upkeep, 'f');
+ MATCH(perc, capacity, 'f');
+ MATCH(perc, recharge, 'f');
+ for (int j=0;j<7; j++) {
+ MATCH_ARRAY(perc, armor, info->damage_types[j], 'f', j);
+ }
+
+ MATCH(base_weapon, cooldown, 'f');
+ MATCH(base_weapon, aoe, 'f');
+ MATCH(base_weapon, knockback, 'f');
+ MATCH(base_weapon, damage_battery, 'f');
+ MATCH(base_weapon, stun, 'f');
+ MATCH(base_weapon, charge_per_shot, 'f');
+ for (int j=0;j<7; j++) {
+ MATCH_ARRAY(base_weapon, damage,
+ info->damage_types[j], 'f', j);
+ }
+ for (int j=0;j<7; j++) {
+ MATCH_ARRAY(base_weapon, armor_reduce,
+ info->damage_types[j], 'f', j);
+ }
+
+ MATCH(perc_weapon, cooldown, 'f');
+ MATCH(perc_weapon, aoe, 'f');
+ MATCH(perc_weapon, knockback, 'f');
+ MATCH(perc_weapon, damage_battery, 'f');
+ MATCH(perc_weapon, stun, 'f');
+ MATCH(perc_weapon, charge_per_shot, 'f');
+ for (int j=0;j<7; j++) {
+ MATCH_ARRAY(perc_weapon, damage,
+ info->damage_types[j], 'f', j);
+ }
+ for (int j=0;j<7; j++) {
+ MATCH_ARRAY(perc_weapon, armor_reduce,
+ info->damage_types[j], 'f', j);
+ }
+ }
+ }
+}
+
+void info_stats_parse (infos *info, char *json, int stats_type) {
+ jsmn_parser p; jsmn_init(&p);
+ jsmntok_t t[MAXTOKENS];
+ int r = jsmn_parse(&p, json, strlen(json), t, MAXTOKENS);
+ int index = 0;
+ for (int i=1; i<r; i++) { // i=1: ignore outer []
+ if (t[i].type == JSMN_OBJECT) {
+ int rt = json_parse_subtokens(json, t, r, i);
+ stats_comp *comp = info->stats[stats_type]
+ +info->statslen[stats_type];
+ stats_comp_parse(json, comp, t+i+1, rt, info);
+ info->statslen[stats_type] ++;
+ i += rt-1;
+
+ stats_comp_printf(comp);
+ }
+ }
+}
+
int info_read_file (char *dst, char *name, int size) {
memset(dst, 0, size*sizeof(char));
FILE *f = fopen(name, "rb");
@@ -802,68 +1005,26 @@ void info_load (infos *info) {
info_read_file(json, "content/templates/default.txt", size);
info_parse_json(info, json, "template");
- /*
- for (int i=0; i<info->unitslen; i++) {
- printf("name: %s\n", info->units[i].name);
- printf(" hp: %f\n", info->units[i].hp);
- printf(" damage: %f\n", info->units[i].damage);
- printf(" range: %f\n", info->units[i].range);
- }*/
- /*
- for (int i=0; i<info->weaponslen; i++) {
- printf("name: %s\n", info->weapons[i].name);
- printf(" damage_type: %d\n", info->weapons[i].damage_type);
- printf(" weight: %f\n", info->weapons[i].weight);
- printf(" cooldown: %f\n", info->weapons[i].cooldown);
- printf(" damage: %f\n", info->weapons[i].damage);
- printf(" range: %f\n", info->weapons[i].range);
- printf(" aoe: %f\n", info->weapons[i].aoe);
- printf(" knockback: %d\n", info->weapons[i].knockback);
- printf(" damage_battery: %f\n", info->weapons[i].damage_battery);
- printf(" stun: %d\n", info->weapons[i].stun);
- float sum = 0; for (int j=0; j<7; j++) {
- sum += info->weapons[i].reduce_armor[j];
- }
- if (sum > 0) {
- printf(" red pierce: %f\n", info->weapons[i].reduce_armor[0]);
- printf(" red laser: %f\n", info->weapons[i].reduce_armor[1]);
- printf(" red impact: %f\n", info->weapons[i].reduce_armor[2]);
- printf(" red fusion: %f\n", info->weapons[i].reduce_armor[3]);
- printf(" red explosive: %f\n", info->weapons[i].reduce_armor[4]);
- printf(" red emp: %f\n", info->weapons[i].reduce_armor[5]);
- printf(" red spread: %f\n", info->weapons[i].reduce_armor[6]);
- }
- }*/
- /*
- for (int i=0; i<info->chassislen; i++) {
- printf("name: %s\n", info->chassis[i].name);
- printf(" slot_weapon: %d\n", info->chassis[i].slot_weapon);
- printf(" slot_armor: %d\n", info->chassis[i].slot_armor);
- printf(" slot_aug: %d\n", info->chassis[i].slot_aug);
- printf(" weight_max: %f\n", info->chassis[i].weight_max);
- printf(" hp: %f\n", info->chassis[i].hp);
- }*/
- /*
- for (int i=0; i<info->batterieslen; i++) {
- printf("name: %s\n", info->batteries[i].name);
- printf(" weight: %f\n", info->batteries[i].weight);
- printf(" capacity: %f\n", info->batteries[i].capacity);
- printf(" recharge: %d\n", info->batteries[i].recharge);
- }*/
- /*
- for (int i=0; i<info->armorslen; i++) {
- printf("name: %s\n", info->armors[i].name);
- printf(" weight: %f\n", info->armors[i].weight);
- printf(" pierce: %f\n", info->armors[i].armor[0]);
- printf(" laser: %f\n", info->armors[i].armor[1]);
- printf(" impact: %f\n", info->armors[i].armor[2]);
- printf(" fusion: %f\n", info->armors[i].armor[3]);
- printf(" explosive: %f\n", info->armors[i].armor[4]);
- printf(" emp: %f\n", info->armors[i].armor[5]);
- printf(" spread: %f\n", info->armors[i].armor[6]);
- }*/
+
+ char files[6][32] = {
+ "content/chassis.txt",
+ "content/brains.txt",
+ "content/batteries.txt",
+ "content/weapons.txt",
+ "content/armor.txt",
+ "content/augments.txt"
+ };
+ for (int i=0; i<6; i++) {
+ info->stats[i] = (stats_comp*)malloc(64*sizeof(stats_comp));
+ if (info->stats[i] != NULL) {
+ info->statslen[i] = 0;
+ info_read_file(json, files[i], size);
+ info_stats_parse(info, json, i);
+ } else { printf("error: out of memory in allocating for stats"); }
+ }
}
+
void info_dump_json_templates (infos *info, char *str) {
int len = 0;
sprintf(str+len, "[ \n"); len = strlen(str);
diff --git a/gst/info.h b/gst/info.h
index 6417cda..825f48c 100644
--- a/gst/info.h
+++ b/gst/info.h
@@ -13,7 +13,57 @@
#define LEVEL_ARMOR 11
#define LEVEL_AUGS 19
-typedef struct {
+#define STATS_CHASSIS 0
+#define STATS_BRAIN 1
+#define STATS_BATTERY 2
+#define STATS_WEAPONS 3
+#define STATS_ARMOR 4
+#define STATS_AUGS 5
+
+// loaded stats
+typedef struct {
+ float damage[7];
+ float cooldown;
+ float aoe;
+ float knockback;
+ float damage_battery;
+ float stun;
+ float armor_reduce[7];
+ float charge_per_shot;
+} stats_weapon;
+
+typedef struct {
+ float hp;
+ float weight;
+ float weight_max;
+ int slot_weapon;
+ int slot_armor;
+ int slot_aug;
+ float speed;
+ float upkeep;
+ float capacity;
+ float recharge;
+ float armor[7];
+} stats_frame;
+
+typedef struct {
+ char name[32];
+ char description[256];
+ stats_frame base[MAXLEVEL];
+ stats_frame perc[MAXLEVEL];
+ stats_weapon base_weapon[MAXLEVEL];
+ stats_weapon perc_weapon[MAXLEVEL];
+} stats_comp;
+
+
+// computed stats ready for army use
+typedef struct {
+ stats_frame frame;
+ stats_weapon weapon[8];
+} stats_unit;
+
+
+typedef struct {
char name[32];
// indexes of info.*
int8_t chassis;
@@ -100,6 +150,9 @@ typedef struct {
int augslen;
info_brain brains[32];
int brainslen;
+
+ stats_comp *stats[5];
+ int statslen[5];
} infos;
void info_unit_init (info_unit *u);
diff --git a/hud/hud.c b/hud/hud.c
index 30b6486..62263c7 100644
--- a/hud/hud.c
+++ b/hud/hud.c
@@ -778,12 +778,30 @@ void hud_render_sel (hud_sel *sc, MKb *mkb, info_unit *u,
SDL_RenderFillRect(rend, &r);
SDL_SetRenderDrawColor(rend, 0, 0, 0, 255);
SDL_RenderDrawRect(rend, &r);
- if (sel==0) render_view_chassis(rend, t, x, y, info, i, 0, sprites);
- if (sel==1) render_view_battery(rend, t, x, y, info, i, 0);
- if (sel==2) render_view_armor_detail(rend, t, x, y, info, i, 0);
- if (sel==3) render_view_weapon_detail(rend, t, x, y, info, i, 0);
- if (sel==4) render_view_aug_detail(rend, t, x, y, info, i, 0);
- if (sel==5) render_view_brain(rend, t, x, y, info, i, 0);
+ if (sel==0) {
+ int lvl = u->levels[LEVEL_CHASSIS];
+ render_view_chassis(rend, t, x, y, info, i, lvl, sprites);
+ }
+ if (sel==1) {
+ int lvl = u->levels[LEVEL_BATTERY];
+ render_view_battery(rend, t, x, y, info, i, lvl);
+ }
+ if (sel==2) {
+ int lvl = u->levels[LEVEL_ARMOR+ind];
+ render_view_armor_detail(rend, t, x, y, info, i, lvl);
+ }
+ if (sel==3) {
+ int lvl = u->levels[LEVEL_WEAPONS+ind];
+ render_view_weapon_detail(rend, t, x, y, info, i, lvl);
+ }
+ if (sel==4) {
+ int lvl = u->levels[LEVEL_AUGS+ind];
+ render_view_aug_detail(rend, t, x, y, info, i, lvl);
+ }
+ if (sel==5) {
+ int lvl = u->levels[LEVEL_BRAIN];
+ render_view_brain(rend, t, x, y, info, i, lvl);
+ }
}
SDL_RenderSetClipRect(rend, NULL);
}
diff --git a/hud/hud_views.c b/hud/hud_views.c
index 86e0722..c767e68 100644
--- a/hud/hud_views.c
+++ b/hud/hud_views.c
@@ -12,13 +12,20 @@
#define LABEL_F3(x, y, s, q, v, d) {\
float p[2]={x,y}; char ss[64]; \
- sprintf(ss, "%s: %."#q"f %."#q"f %."#q"f", s, v[0], v[1], v[2]);\
+ if (lvl == 0) \
+ sprintf(ss, "%s: (%."#q"f) %."#q"f %."#q"f", s, v[0], v[1], v[2]);\
+ if (lvl == 1) \
+ sprintf(ss, "%s: %."#q"f (%."#q"f) %."#q"f", s, v[0], v[1], v[2]);\
+ if (lvl == 2) \
+ sprintf(ss, "%s: %."#q"f %."#q"f (%."#q"f)", s, v[0], v[1], v[2]);\
render_text_scaled(rend, ss, p, t, d);\
}
#define LABEL_I3(x, y, s, v, d) {\
float p[2]={x,y}; char ss[64]; \
- sprintf(ss, "%s: %d %d %d", s, v[0], v[1], v[2]);\
+ if (lvl == 0) sprintf(ss, "%s: (%d) %d %d", s, v[0], v[1], v[2]);\
+ if (lvl == 1) sprintf(ss, "%s: %d (%d) %d", s, v[0], v[1], v[2]);\
+ if (lvl == 2) sprintf(ss, "%s: %d %d (%d)", s, v[0], v[1], v[2]);\
render_text_scaled(rend, ss, p, t, 1);\
}
diff --git a/json/jsonparse.c b/json/jsonparse.c
index 4b5096c..65fe3e9 100644
--- a/json/jsonparse.c
+++ b/json/jsonparse.c
@@ -35,7 +35,7 @@ void json_dump_array (char *str, void *arr, int len, char type) {
sprintf(str+cur, "[ "); cur = strlen(str);
for (int i=0; i<len; i++) {
if (type == 'i') {
- sprintf(str+cur, "%d", ((int)(intptr_t)(arr))[i]);
+ sprintf(str+cur, "%d", ((int*)(intptr_t)(arr))[i]);
cur = strlen(str);
}
if (type == 'c') {
diff --git a/main.c b/main.c
index b34ea61..f9da679 100644
--- a/main.c
+++ b/main.c
@@ -25,6 +25,8 @@ Mix_Music *gMusic = NULL;
//The sound effects that will be used
Mix_Chunk *sounds[16];
+#define A(a, arg) printf("value: %d", a.arg);
+struct a { int v; } biga;
int main( int argc, char* args[] ) {
net_init();