1246 lines
59 KiB
Plaintext
1246 lines
59 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "2cc54913",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Imports and globals\n",
|
|
"\n",
|
|
"import glob\n",
|
|
"import re\n",
|
|
"import luadata\n",
|
|
"\n",
|
|
"damage_mult = 30\n",
|
|
"range_mult = 3\n",
|
|
"speed_mult = 3\n",
|
|
"\n",
|
|
"ballistic_velocity = 30\n",
|
|
"energy_velocity = 60\n",
|
|
"pulse_velocity = 120\n",
|
|
"missile_velocity = 15\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 45,
|
|
"id": "48125b87",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"['units\\\\CLANERPPCTURRET\\\\CLANERPPCTURRET_unit.bp',\n",
|
|
" 'units\\\\CLANFACTORYAT1\\\\CLANFACTORYAT1_unit.bp',\n",
|
|
" 'units\\\\CLANJI50\\\\HHJI50_unit.bp',\n",
|
|
" 'units\\\\CLANJI50ML\\\\CLANJI50ML_unit.bp',\n",
|
|
" 'units\\\\CLANKIRGHIZB\\\\CLANKIRGHIZB_unit.bp',\n",
|
|
" 'units\\\\CLANLBX5TURRET\\\\CLANLBX5TURRET_unit.bp',\n",
|
|
" 'units\\\\CLANMECHBAY\\\\CLANMECHBAY_unit.bp',\n",
|
|
" 'units\\\\CLANMFACTORYT1\\\\CLANMFACTORYT1_unit.bp',\n",
|
|
" 'units\\\\CLANMFACTORYT2\\\\CLANMFACTORYT2_unit.bp',\n",
|
|
" 'units\\\\CLANMPLTURRET\\\\CLANMPLTURRET_unit.bp',\n",
|
|
" 'units\\\\CLANVFACTORYT1\\\\CLANVFACTORYT1_unit.bp',\n",
|
|
" 'units\\\\CLANVFACTORYT2\\\\CLANVFACTORYT2_unit.bp',\n",
|
|
" 'units\\\\CLANVISIGOTHB\\\\CLANVISIGOTHB_unit.bp',\n",
|
|
" 'units\\\\CLANWARHAWKPRIME\\\\CLANWARHAWKPRIME_unit.bp',\n",
|
|
" 'units\\\\FSAGS2D\\\\FSAGS2D_unit.bp',\n",
|
|
" 'units\\\\FSALACORN\\\\FSALACORN_unit.bp',\n",
|
|
" 'units\\\\FSAS7D\\\\FSAS7D_unit.bp',\n",
|
|
" 'units\\\\FSASW8Q\\\\FSASW8Q_unit.bp',\n",
|
|
" 'units\\\\FSBSWS2\\\\FSBSWS2_unit.bp',\n",
|
|
" 'units\\\\FSBSWX1\\\\FSBSWX1_unit.bp',\n",
|
|
" 'units\\\\FSBULLDOG\\\\FSBULLDOG_unit.bp',\n",
|
|
" 'units\\\\FSCALI\\\\FSCALI_unit.bp',\n",
|
|
" 'units\\\\FSCENTIPEDE\\\\FSCENTIPEDE_unit.bp',\n",
|
|
" 'units\\\\FSCENTURION\\\\FSCENTURION_unit.bp',\n",
|
|
" 'units\\\\FSCOM2D\\\\FSCOM2D_unit.bp',\n",
|
|
" 'units\\\\FSCOMET\\\\FSCOMET_unit.bp',\n",
|
|
" 'units\\\\FSCONDOR\\\\FSCONDOR_unit.bp',\n",
|
|
" 'units\\\\FSCPTLC1\\\\FSCPTLC1_unit.bp',\n",
|
|
" 'units\\\\FSCUT01D\\\\FSCUT01D_unit.bp',\n",
|
|
" 'units\\\\FSCUT1E\\\\FSCUT1E_unit.bp',\n",
|
|
" 'units\\\\FSFACTORYAT1\\\\FSFACTORYAT1_unit.bp',\n",
|
|
" 'units\\\\FSFACTORYAT2\\\\FSFACTORYAT2_unit.bp',\n",
|
|
" 'units\\\\FSFACTORYDST2\\\\FSFACTORYDST2_unit.bp',\n",
|
|
" 'units\\\\FSFACTORYLT1\\\\FSFACTORYLT1_unit.bp',\n",
|
|
" 'units\\\\FSFACTORYLT2\\\\FSFACTORYLT2_unit.bp',\n",
|
|
" 'units\\\\FSFACTORYNT1\\\\FSFACTORYNT1_unit.bp',\n",
|
|
" 'units\\\\FSGAZELLE\\\\FSGAZELLE_unit.bp',\n",
|
|
" 'units\\\\FSGENT1\\\\FSGENT1_unit.bp',\n",
|
|
" 'units\\\\FSGENT2\\\\FSGENT2_unit.bp',\n",
|
|
" 'units\\\\FSGRTURRET\\\\FSGRTURRET_unit.bp',\n",
|
|
" 'units\\\\FSHARASSER\\\\FSHARASSER_unit.bp',\n",
|
|
" 'units\\\\FSHVYTOWER\\\\FSHVYTOWER_unit.bp',\n",
|
|
" 'units\\\\FSISBA\\\\FSISBA_unit.bp',\n",
|
|
" 'units\\\\FSJEDGAR\\\\FSJEDGAR_unit.bp',\n",
|
|
" 'units\\\\FSJI50\\\\FSJI50_unit.bp',\n",
|
|
" 'units\\\\FSJI50ML\\\\FSJI50ML_unit.bp',\n",
|
|
" 'units\\\\FSJR7D\\\\FSJR7D_unit.bp',\n",
|
|
" 'units\\\\FSKARNOV\\\\FSKARNOV_unit.bp',\n",
|
|
" 'units\\\\FSLCT1M\\\\FSLCT1M_unit.bp',\n",
|
|
" 'units\\\\FSLEOPARD\\\\FSLEOPARDDS_unit.bp',\n",
|
|
" 'units\\\\FSLONGTOM\\\\FSLONGTOM_unit.bp',\n",
|
|
" 'units\\\\FSLONGTOMCANNON\\\\FSLONGTOMCANNON_unit.bp',\n",
|
|
" 'units\\\\FSLRM\\\\FSLRM_unit.bp',\n",
|
|
" 'units\\\\FSMANTICORE\\\\FSMANTICORE_unit.bp',\n",
|
|
" 'units\\\\FSMECHBAY\\\\FSMECHBAY_unit.bp',\n",
|
|
" 'units\\\\FSMETEOR\\\\FSMETEOR_unit.bp',\n",
|
|
" 'units\\\\FSMONITOR\\\\FSMONITOR_unit.bp',\n",
|
|
" 'units\\\\FSNEPTUNESTD\\\\FSNEPTUNESTD_unit.bp',\n",
|
|
" 'units\\\\FSPARTISAN\\\\FSPARTISAN_unit.bp',\n",
|
|
" 'units\\\\FSPEGASUS\\\\FSPEGASUS_unit.bp',\n",
|
|
" 'units\\\\FSPIKE\\\\FSPIKE_unit.bp',\n",
|
|
" 'units\\\\FSPILUM\\\\FSPILUM_unit.bp',\n",
|
|
" 'units\\\\FSREGULATOR\\\\FSREGULATOR_unit.bp',\n",
|
|
" 'units\\\\FSRVN3L\\\\FSRVN3L_unit.bp',\n",
|
|
" 'units\\\\FSSARACEN\\\\FSSARACEN_unit.bp',\n",
|
|
" 'units\\\\FSSCHREK\\\\FSSCHREK_unit.bp',\n",
|
|
" 'units\\\\FSSCORPIONLT\\\\FSSCORPIONLT_unit.bp',\n",
|
|
" 'units\\\\FSSF1X\\\\FSSF1X_unit.bp',\n",
|
|
" 'units\\\\FSSRM\\\\FSSRM_unit.bp',\n",
|
|
" 'units\\\\FSSTRIKERLT\\\\FSSTRIKERLT_unit.bp',\n",
|
|
" 'units\\\\FSSTUK5\\\\FSSTUK5_unit.bp',\n",
|
|
" 'units\\\\FST1AA\\\\FST1AA_unit.bp',\n",
|
|
" 'units\\\\FST1LLTURRET\\\\FST1LLTURRET_unit.bp',\n",
|
|
" 'units\\\\FST2AA\\\\FST2AA_unit.bp',\n",
|
|
" 'units\\\\FSTDR7SE\\\\FSTDR7SE_unit.bp',\n",
|
|
" 'units\\\\FSUZL2S\\\\FSUZL2S_unit.bp',\n",
|
|
" 'units\\\\FSVFACTORYT1\\\\FSVFACTORYT1_unit.bp',\n",
|
|
" 'units\\\\FSVFACTORYT2\\\\FSVFACTORYT2_unit.bp',\n",
|
|
" 'units\\\\FSVNLK100\\\\FSVNLK100_unit.bp',\n",
|
|
" 'units\\\\FSWARRIORH7\\\\FSWARRIORH7_unit.bp',\n",
|
|
" 'units\\\\HHEPONA\\\\HHEPONA_unit.bp',\n",
|
|
" 'units\\\\HHGOLEMROCK\\\\HHGOLEMROCK_unit.bp',\n",
|
|
" 'units\\\\HHHEPHAESTUS\\\\HHHEPHAESTUS_unit.bp',\n",
|
|
" 'units\\\\HHHVYTOWER\\\\HHHVYTOWER_unit.bp',\n",
|
|
" 'units\\\\HHMADDOGE\\\\HHMADDOGE_unit.bp',\n",
|
|
" 'units\\\\HHMARSXL\\\\HHMARSXL_unit.bp',\n",
|
|
" 'units\\\\HHORO\\\\HHORO_unit.bp',\n",
|
|
" 'units\\\\LAALACORN\\\\LAALACORN_unit.bp',\n",
|
|
" 'units\\\\LAAS7D\\\\LAAS7D_unit.bp',\n",
|
|
" 'units\\\\LAASW8Q\\\\LAASW8Q_unit.bp',\n",
|
|
" 'units\\\\LABSWS2\\\\LABSWS2_unit.bp',\n",
|
|
" 'units\\\\LABSWX1\\\\LABSWX1_unit.bp',\n",
|
|
" 'units\\\\LABULLDOG\\\\LABULLDOG_unit.bp',\n",
|
|
" 'units\\\\LACALI\\\\LACALI_unit.bp',\n",
|
|
" 'units\\\\LACENTIPEDE\\\\LACENTIPEDE_unit.bp',\n",
|
|
" 'units\\\\LACENTURION\\\\LACENTURION_unit.bp',\n",
|
|
" 'units\\\\LACOM2D\\\\LACOM2D_unit.bp',\n",
|
|
" 'units\\\\LACPTLC1\\\\LACPTLC1_unit.bp',\n",
|
|
" 'units\\\\LAEMP6S\\\\LAEMP6S_unit.bp',\n",
|
|
" 'units\\\\LAESTOC\\\\LAESTOC_unit.bp',\n",
|
|
" 'units\\\\LAF90\\\\LAF90_unit.bp',\n",
|
|
" 'units\\\\LAFACTORYAT1\\\\LAFACTORYAT1_unit.bp',\n",
|
|
" 'units\\\\LAFACTORYAT2\\\\LAFACTORYAT2_unit.bp',\n",
|
|
" 'units\\\\LAFACTORYDST2\\\\LAFACTORYDST2_unit.bp',\n",
|
|
" 'units\\\\LAFACTORYLT1\\\\LAFACTORYLT1_unit.bp',\n",
|
|
" 'units\\\\LAFACTORYLT2\\\\LAFACTORYLT2_unit.bp',\n",
|
|
" 'units\\\\LAFACTORYNT1\\\\LAFACTORYNT1_unit.bp',\n",
|
|
" 'units\\\\LAFNR5\\\\LAFNR5_unit.bp',\n",
|
|
" 'units\\\\LAGAZELLE\\\\LAGAZELLE_unit.bp',\n",
|
|
" 'units\\\\LAGENT1\\\\LAGENT1_unit.bp',\n",
|
|
" 'units\\\\LAGENT2\\\\LAGENT2_unit.bp',\n",
|
|
" 'units\\\\LAGRTURRET\\\\LAGRTURRET_unit.bp',\n",
|
|
" 'units\\\\LAGURTELTIERMBT\\\\LAGURTELTIERMBT_unit.bp',\n",
|
|
" 'units\\\\LAHBK4G\\\\LAHBK4G_unit.bp',\n",
|
|
" 'units\\\\LAHOLLANDERII\\\\LAHOLLANDERII_unit.bp',\n",
|
|
" 'units\\\\LAHVYTOWER\\\\LAHVYTOWER_unit.bp',\n",
|
|
" 'units\\\\LAISBA\\\\LAISBA_unit.bp',\n",
|
|
" 'units\\\\LAJI50\\\\LAJI50_unit.bp',\n",
|
|
" 'units\\\\LAJI50ML\\\\LAJI50ML_unit.bp',\n",
|
|
" 'units\\\\LAKARNOV\\\\LAKARNOV_unit.bp',\n",
|
|
" 'units\\\\LALEOPARD\\\\LALEOPARDDS_unit.bp',\n",
|
|
" 'units\\\\LALONGTOM\\\\LALONGTOM_unit.bp',\n",
|
|
" 'units\\\\LALONGTOMCANNON\\\\LALONGTOMCANNON_unit.bp',\n",
|
|
" 'units\\\\LALRM\\\\LALRM_unit.bp',\n",
|
|
" 'units\\\\LALTOWER\\\\LALTOWER_unit.bp',\n",
|
|
" 'units\\\\LAMANTICORE\\\\LAMANTICORE_unit.bp',\n",
|
|
" 'units\\\\LAMECHBAY\\\\LAMECHBAY_unit.bp',\n",
|
|
" 'units\\\\LAMONITOR\\\\LAMONITOR_unit.bp',\n",
|
|
" 'units\\\\LANEPTUNESTD\\\\LANEPTUNESTD_unit.bp',\n",
|
|
" 'units\\\\LAOWL\\\\LAOWL_unit.bp',\n",
|
|
" 'units\\\\LAOWL2\\\\LAOWL2_unit.bp',\n",
|
|
" 'units\\\\LAPARTISAN\\\\LAPARTISAN_unit.bp',\n",
|
|
" 'units\\\\LAPATTON\\\\LAPATTON_unit.bp',\n",
|
|
" 'units\\\\LAPATTONULTRA\\\\LAPATTONULTRA_unit.bp',\n",
|
|
" 'units\\\\LAPEGASUS\\\\LAPEGASUS_unit.bp',\n",
|
|
" 'units\\\\LAPILUM\\\\LAPILUM_unit.bp',\n",
|
|
" 'units\\\\LAPPR5T\\\\LAPPR5T_unit.bp',\n",
|
|
" 'units\\\\LAREGULATOR\\\\LAREGULATOR_unit.bp',\n",
|
|
" 'units\\\\LAROMMEL\\\\LAROMMEL_unit.bp',\n",
|
|
" 'units\\\\LASCHREK\\\\LASCHREK_unit.bp',\n",
|
|
" 'units\\\\LASRM\\\\LASRM_unit.bp',\n",
|
|
" 'units\\\\LASTEINADLER\\\\LASTEINADLER_unit.bp',\n",
|
|
" 'units\\\\LASTO4A\\\\LASTO4A_unit.bp',\n",
|
|
" 'units\\\\LASTRIKERLT\\\\LASTRIKERLT_unit.bp',\n",
|
|
" 'units\\\\LASTUK5\\\\LASTUK5_unit.bp',\n",
|
|
" 'units\\\\LASYDZ3A\\\\LASYDZ3A_unit.bp',\n",
|
|
" 'units\\\\LAT1AA\\\\LAT1AA_unit.bp',\n",
|
|
" 'units\\\\LAT1LLTURRET\\\\LAT1LLTURRET_unit.bp',\n",
|
|
" 'units\\\\LAT2AA\\\\LAT2AA_unit.bp',\n",
|
|
" 'units\\\\LATDR7SE\\\\LATDR7SE_unit.bp',\n",
|
|
" 'units\\\\LAUZL2S\\\\LAUZL2S_unit.bp',\n",
|
|
" 'units\\\\LAVFACTORYT1\\\\LAVFACTORYT1_unit.bp',\n",
|
|
" 'units\\\\LAVFACTORYT2\\\\LAVFACTORYT2_unit.bp',\n",
|
|
" 'units\\\\LAVNLK65N\\\\LAVNLK65N_unit.bp',\n",
|
|
" 'units\\\\LAWARRIORH7\\\\LAWARRIORH7_unit.bp',\n",
|
|
" 'units\\\\SRELEMENTAL\\\\SRELEMENTAL_unit.bp',\n",
|
|
" 'units\\\\SRKITFOX\\\\SRKITFOX_unit.bp',\n",
|
|
" 'units\\\\SRKITFOXC\\\\SRKITFOXC_unit.bp',\n",
|
|
" 'units\\\\SRKODIAK3\\\\SRKODIAK3_unit.bp',\n",
|
|
" 'units\\\\SRMADDOG\\\\SRMADDOG_unit.bp',\n",
|
|
" 'units\\\\SRORO\\\\SRORO_unit.bp',\n",
|
|
" 'units\\\\SROROHAG\\\\SROROHAG_unit.bp',\n",
|
|
" 'units\\\\SRRIFLEMANIIC\\\\SRRIFLEMANIIC_unit.bp',\n",
|
|
" 'units\\\\SRSTORMCROW\\\\SRSTORMCROW_unit.bp',\n",
|
|
" 'units\\\\SRSTORMCROWA\\\\SRSTORMCROWA_unit.bp',\n",
|
|
" 'units\\\\SRTIMBERWOLF\\\\SRTIMBERWOLF_unit.bp',\n",
|
|
" 'units\\\\WDBANDITCP\\\\WDBANDITCP_unit.bp']"
|
|
]
|
|
},
|
|
"execution_count": 45,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Find all blueprints\n",
|
|
"\n",
|
|
"files = glob.glob('units/*/*_unit.bp')\n",
|
|
"files"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 46,
|
|
"id": "7974de88",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"{'Destroyed': 125,\n",
|
|
" 'DoneBeingBuilt': 49,\n",
|
|
" 'UISelection': 167,\n",
|
|
" 'Fire': 409,\n",
|
|
" 'Construct': 27,\n",
|
|
" 'ConstructLoop': 27,\n",
|
|
" 'DeathExplosion': 34,\n",
|
|
" 'AmbientMove': 105,\n",
|
|
" 'CaptureLoop': 6,\n",
|
|
" 'HoverKilledOnWater': 19,\n",
|
|
" 'ReclaimLoop': 6,\n",
|
|
" 'StartCapture': 6,\n",
|
|
" 'StartMove': 118,\n",
|
|
" 'StartReclaim': 6,\n",
|
|
" 'StopMove': 118,\n",
|
|
" 'AirUnitWaterImpact': 23,\n",
|
|
" 'Killed': 65,\n",
|
|
" 'Landing': 23,\n",
|
|
" 'Refueling': 15,\n",
|
|
" 'Thruster': 23,\n",
|
|
" 'AmbientMoveLand': 13,\n",
|
|
" 'AmbientMoveWater': 13,\n",
|
|
" 'EnterWater': 13,\n",
|
|
" 'TransitionWater': 13,\n",
|
|
" 'ActiveLoop': 4,\n",
|
|
" 'AmbientMoveSub': 2,\n",
|
|
" 'StartMoveSub': 2,\n",
|
|
" 'StopMoveSub': 2,\n",
|
|
" 'SubmergeStart': 2,\n",
|
|
" 'SurfaceStart': 2,\n",
|
|
" 'BarrelLoop': 4,\n",
|
|
" 'BarrelStart': 4,\n",
|
|
" 'MuzzleChargeStart': 1}"
|
|
]
|
|
},
|
|
"execution_count": 46,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Find all sound types\n",
|
|
"\n",
|
|
"sounds = {}\n",
|
|
"\n",
|
|
"for filepath in files:\n",
|
|
" file = open(filepath, 'r')\n",
|
|
" lines = file.readlines()\n",
|
|
" file.close()\n",
|
|
"\n",
|
|
" for line in lines:\n",
|
|
" check = re.match(r\"^(\\s*)(\\w+) = Sound {$\", line)\n",
|
|
" if check is not None:\n",
|
|
" sound_type = check.group(2)\n",
|
|
" if sound_type in sounds:\n",
|
|
" sounds[sound_type] += 1\n",
|
|
" else:\n",
|
|
" sounds[sound_type] = 1\n",
|
|
"\n",
|
|
"sounds"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 47,
|
|
"id": "f75cfb51",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Sanity check\n",
|
|
"\n",
|
|
"for filepath in files:\n",
|
|
" blueprint = luadata.read(filepath)\n",
|
|
"\n",
|
|
" assert 'BTSource' in blueprint\n",
|
|
" assert 'BattleValue' in blueprint['BTSource']\n",
|
|
" assert 'Tonnage' in blueprint['BTSource']\n",
|
|
" assert 'HitPoints' in blueprint['BTSource']"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "23145ae9",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Compute defense\n",
|
|
"\n",
|
|
"for filepath in files:\n",
|
|
" blueprint = luadata.read(filepath)\n",
|
|
"\n",
|
|
" assert 'Defense' in blueprint\n",
|
|
" \n",
|
|
" battle_value = blueprint['BTSource']['BattleValue']\n",
|
|
" tonnage = blueprint['BTSource']['Tonnage']\n",
|
|
" hit_points = blueprint['BTSource']['HitPoints']\n",
|
|
"\n",
|
|
" # air threat\n",
|
|
" is_air_threat = 'AIR' in blueprint['Categories'] or 'ANTIAIR' in blueprint['Categories'] or 'HIGHALTAIR' in blueprint['Categories']\n",
|
|
" if is_air_threat:\n",
|
|
" if battle_value != 0:\n",
|
|
" blueprint['Defense']['AirThreatLevel'] = battle_value / 10\n",
|
|
" elif tonnage != 0:\n",
|
|
" blueprint['Defense']['AirThreatLevel'] = tonnage\n",
|
|
" else:\n",
|
|
" blueprint['Defense']['AirThreatLevel'] = hit_points / 1000\n",
|
|
" if not is_air_threat and 'AirThreatLevel' in blueprint['Defense']:\n",
|
|
" blueprint['Defense'].pop('AirThreatLevel')\n",
|
|
"\n",
|
|
" # economy threat\n",
|
|
" is_economy_threat = 'STRUCTURE' in blueprint['Categories']\n",
|
|
" if is_economy_threat:\n",
|
|
" if battle_value != 0:\n",
|
|
" blueprint['Defense']['EconomyThreatLevel'] = battle_value / 10\n",
|
|
" elif tonnage != 0:\n",
|
|
" blueprint['Defense']['EconomyThreatLevel'] = tonnage\n",
|
|
" else:\n",
|
|
" blueprint['Defense']['EconomyThreatLevel'] = hit_points / 1000\n",
|
|
" if not is_economy_threat and 'EconomyThreatLevel' in blueprint['Defense']:\n",
|
|
" blueprint['Defense'].pop('EconomyThreatLevel')\n",
|
|
"\n",
|
|
" # sub threat\n",
|
|
" is_sub_threat = 'NAVAL' in blueprint['Categories'] or 'ANTINAVY' in blueprint['Categories']\n",
|
|
" if is_sub_threat:\n",
|
|
" if battle_value != 0:\n",
|
|
" blueprint['Defense']['SubThreatLevel'] = battle_value / 10\n",
|
|
" elif tonnage != 0:\n",
|
|
" blueprint['Defense']['SubThreatLevel'] = tonnage\n",
|
|
" else:\n",
|
|
" blueprint['Defense']['SubThreatLevel'] = hit_points / 1000\n",
|
|
" if not is_sub_threat and 'SubThreatLevel' in blueprint['Defense']:\n",
|
|
" blueprint['Defense'].pop('SubThreatLevel')\n",
|
|
"\n",
|
|
" # surface threat\n",
|
|
" is_surface_threat = 'LAND' in blueprint['Categories'] or 'DEFENSE' in blueprint['Categories']\n",
|
|
" if is_surface_threat:\n",
|
|
" if battle_value != 0:\n",
|
|
" blueprint['Defense']['SurfaceThreatLevel'] = battle_value / 10\n",
|
|
" elif tonnage != 0:\n",
|
|
" blueprint['Defense']['SurfaceThreatLevel'] = tonnage\n",
|
|
" else:\n",
|
|
" blueprint['Defense']['SurfaceThreatLevel'] = hit_points / 1000\n",
|
|
" if not is_surface_threat and 'SurfaceThreatLevel' in blueprint['Defense']:\n",
|
|
" blueprint['Defense'].pop('SurfaceThreatLevel')\n",
|
|
"\n",
|
|
" # health\n",
|
|
" blueprint['Defense']['Health'] = hit_points * damage_mult\n",
|
|
" blueprint['Defense']['MaxHealth'] = hit_points * damage_mult\n",
|
|
"\n",
|
|
" luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "d69eb968",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Compute economy\n",
|
|
"\n",
|
|
"for filepath in files:\n",
|
|
" blueprint = luadata.read(filepath)\n",
|
|
"\n",
|
|
" assert 'Economy' in blueprint\n",
|
|
"\n",
|
|
" battle_value = blueprint['BTSource']['BattleValue']\n",
|
|
" tonnage = blueprint['BTSource']['Tonnage']\n",
|
|
" hit_points = blueprint['BTSource']['HitPoints']\n",
|
|
"\n",
|
|
" # build cost\n",
|
|
" if battle_value != 0:\n",
|
|
" blueprint['Economy']['BuildCostMass'] = battle_value\n",
|
|
" blueprint['Economy']['BuildCostEnergy'] = battle_value * 10\n",
|
|
" else:\n",
|
|
" blueprint['Economy']['BuildCostMass'] = hit_points / 20\n",
|
|
" blueprint['Economy']['BuildCostEnergy'] = hit_points / 2 * tonnage / 10\n",
|
|
"\n",
|
|
" # build time\n",
|
|
" # if tonnage != 0:\n",
|
|
" # blueprint['Economy']['BuildTime'] = (tonnage * 10) * (hit_points / 100)\n",
|
|
" if tonnage != 0 and battle_value != 0:\n",
|
|
" blueprint['Economy']['BuildTime'] = (tonnage * 10) * (battle_value / 100)\n",
|
|
" elif tonnage != 0:\n",
|
|
" blueprint['Economy']['BuildTime'] = tonnage * 50\n",
|
|
" elif battle_value != 0:\n",
|
|
" blueprint['Economy']['BuildTime'] = battle_value / 60\n",
|
|
" else:\n",
|
|
" blueprint['Economy']['BuildTime'] = hit_points / 3600\n",
|
|
"\n",
|
|
" # storage\n",
|
|
" if battle_value != 0 and 'StorageEnergy' in blueprint['Economy']:\n",
|
|
" blueprint['Economy']['StorageEnergy'] = battle_value * 5\n",
|
|
" if battle_value != 0 and 'StorageMass' in blueprint['Economy']:\n",
|
|
" blueprint['Economy']['StorageMass'] = battle_value / 2\n",
|
|
"\n",
|
|
" luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "4677f981",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"for filepath in files:\n",
|
|
" blueprint = luadata.read(filepath)\n",
|
|
" \n",
|
|
" if 'Weapon' in blueprint:\n",
|
|
" for weapon in blueprint['Weapon']:\n",
|
|
"\n",
|
|
" racks = len(weapon['RackBones'])\n",
|
|
" weapon['RateOfFire'] = racks / 10\n",
|
|
" weapon['TargetCheckInterval'] = (racks / 10) * 2\n",
|
|
"\n",
|
|
" salvo_size = weapon['MuzzleSalvoSize']\n",
|
|
" if salvo_size > 1:\n",
|
|
" weapon['MuzzleSalvoDelay'] = 1 / salvo_size\n",
|
|
" else:\n",
|
|
" weapon['MuzzleSalvoDelay'] = 0\n",
|
|
"\n",
|
|
" luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "23747809",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Standardize weapon targets\n",
|
|
"\n",
|
|
"for filepath in files:\n",
|
|
" blueprint = luadata.read(filepath)\n",
|
|
" \n",
|
|
" if 'Weapon' in blueprint:\n",
|
|
" for weapon in blueprint['Weapon']:\n",
|
|
"\n",
|
|
" # weapon['AboveWaterFireOnly']\n",
|
|
" # weapon['AboveWaterTargetsOnly']\n",
|
|
"\n",
|
|
" weapon['FireTargetLayerCapsTable'] = {} # clear existing\n",
|
|
"\n",
|
|
" if 'AIR' in blueprint['Categories'] or 'HIGHALTAIR' in blueprint['Categories']:\n",
|
|
" weapon['FireTargetLayerCapsTable']['Air'] = 'Air|Land|Water'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Land'] = 'Air|Land|Water'\n",
|
|
"\n",
|
|
" if 'LAND' in blueprint['Categories']:\n",
|
|
" weapon['FireTargetLayerCapsTable']['Land'] = 'Air|Land|Water'\n",
|
|
" \n",
|
|
" if 'MECH' in blueprint['Categories']:\n",
|
|
" weapon['FireTargetLayerCapsTable']['Land'] = 'Air|Land|Water'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Water'] = 'Air|Land|Water|Sub|Seabed'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Seabed'] = 'Water|Sub|Seabed'\n",
|
|
"\n",
|
|
" if 'HOVER' in blueprint['Categories']:\n",
|
|
" weapon['FireTargetLayerCapsTable']['Land'] = 'Air|Land|Water'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Water'] = 'Air|Land|Water'\n",
|
|
"\n",
|
|
" if 'NAVAL' in blueprint['Categories']:\n",
|
|
" weapon['FireTargetLayerCapsTable']['Water'] = 'Air|Land|Water|Sub|Seabed'\n",
|
|
"\n",
|
|
" if 'SUBMERSIBLE' in blueprint['Categories']:\n",
|
|
" weapon['FireTargetLayerCapsTable']['Water'] = 'Air|Land|Water|Sub|Seabed'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Sub'] = 'Water|Sub|Seabed'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Seabed'] = 'Water|Sub|Seabed'\n",
|
|
"\n",
|
|
" weapon['TargetRestrictDisallow'] = 'UNTARGETABLE'\n",
|
|
" # weapon['UseFiringSolutionInsteadOfAimBone'] = true\n",
|
|
"\n",
|
|
" if 'Intel' in blueprint and 'RadarRadius' in blueprint['Intel']:\n",
|
|
" weapon['TrackingRadius'] = blueprint['Intel']['RadarRadius']\n",
|
|
" elif 'Intel' in blueprint and 'VisionRadius' in blueprint['Intel']:\n",
|
|
" weapon['TrackingRadius'] = blueprint['Intel']['VisionRadius']\n",
|
|
"\n",
|
|
" luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "c2ce647b",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Standardize weapon target priorities\n",
|
|
"\n",
|
|
"minimal = [\n",
|
|
" 'SPECIALHIGHPRI',\n",
|
|
" 'SPECIALLOWPRI',\n",
|
|
" 'ALLUNITS',\n",
|
|
"]\n",
|
|
"bomber = [\n",
|
|
" 'SPECIALHIGHPRI',\n",
|
|
" 'STRUCTURE',\n",
|
|
" 'SPECIALLOWPRI',\n",
|
|
" 'ALLUNITS',\n",
|
|
"]\n",
|
|
"basic = [\n",
|
|
" 'SPECIALHIGHPRI',\n",
|
|
" 'MOBILE',\n",
|
|
" 'STRUCTURE DEFENSE',\n",
|
|
" 'SPECIALLOWPRI',\n",
|
|
" 'ALLUNITS',\n",
|
|
"]\n",
|
|
"chaff = [\n",
|
|
" 'SPECIALHIGHPRI',\n",
|
|
" 'TECH1 MOBILE',\n",
|
|
" 'TECH2 MOBILE',\n",
|
|
" 'TECH3 MOBILE',\n",
|
|
" 'STRUCTURE DEFENSE',\n",
|
|
" 'SPECIALLOWPRI',\n",
|
|
" 'ALLUNITS',\n",
|
|
"]\n",
|
|
"focus = [\n",
|
|
" 'SPECIALHIGHPRI',\n",
|
|
" 'TECH3 MOBILE',\n",
|
|
" 'TECH2 MOBILE',\n",
|
|
" 'TECH1 MOBILE',\n",
|
|
" 'STRUCTURE DEFENSE',\n",
|
|
" 'SPECIALLOWPRI',\n",
|
|
" 'ALLUNITS',\n",
|
|
"]\n",
|
|
"air = [\n",
|
|
" 'SPECIALHIGHPRI',\n",
|
|
" 'AIR MOBILE HIGHPRIAIR',\n",
|
|
" 'AIR MOBILE TECH3 BOMBER',\n",
|
|
" 'AIR MOBILE BOMBER',\n",
|
|
" 'AIR MOBILE GROUNDATTACK',\n",
|
|
" 'AIR MOBILE TRANSPORTATION',\n",
|
|
" 'AIR MOBILE',\n",
|
|
" 'SPECIALLOWPRI',\n",
|
|
" 'ALLUNITS',\n",
|
|
"]\n",
|
|
"air_focus = [\n",
|
|
" 'SPECIALHIGHPRI',\n",
|
|
" 'TECH3 MOBILE',\n",
|
|
" 'TECH2 MOBILE',\n",
|
|
" 'TECH1 MOBILE',\n",
|
|
" 'AIR MOBILE HIGHPRIAIR',\n",
|
|
" 'AIR MOBILE TECH3 BOMBER',\n",
|
|
" 'AIR MOBILE BOMBER',\n",
|
|
" 'AIR MOBILE GROUNDATTACK',\n",
|
|
" 'AIR MOBILE TRANSPORTATION',\n",
|
|
" 'AIR MOBILE',\n",
|
|
" 'STRUCTURE DEFENSE',\n",
|
|
" 'SPECIALLOWPRI',\n",
|
|
" 'ALLUNITS',\n",
|
|
"]\n",
|
|
"naval_maingun = [\n",
|
|
" 'SPECIALHIGHPRI',\n",
|
|
" 'NAVAL MOBILE',\n",
|
|
" 'SPECIALLOWPRI',\n",
|
|
" 'ALLUNITS',\n",
|
|
"]\n",
|
|
"\n",
|
|
"for filepath in files:\n",
|
|
" blueprint = luadata.read(filepath)\n",
|
|
" \n",
|
|
" if 'Weapon' in blueprint:\n",
|
|
" for weapon in blueprint['Weapon']:\n",
|
|
" if blueprint['WeaponCategory'] == 'Bomb':\n",
|
|
" weapon['TargetPriorities'] = bomber\n",
|
|
"\n",
|
|
" luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "8075055d",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Standardize weapon stats\n",
|
|
"\n",
|
|
"for filepath in files:\n",
|
|
" blueprint = luadata.read(filepath)\n",
|
|
" \n",
|
|
" if 'Weapon' in blueprint:\n",
|
|
" for weapon in blueprint['Weapon']:\n",
|
|
" if weapon['DisplayName'] == 'Particle Projector Cannon':\n",
|
|
" weapon['Damage'] = 10 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 18 * range_mult\n",
|
|
" weapon['MinRadius'] = 3 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['ProjectileId'] = '/projectiles/ADFOblivionCannon01/ADFOblivionCannon01_proj.bp'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Extended-Range Particle Projector Cannon':\n",
|
|
" weapon['Damage'] = 10 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 23 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['ProjectileId'] = '/projectiles/ADFOblivionCannon02/ADFOblivionCannon02_proj.bp'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Small Laser':\n",
|
|
" weapon['Damage'] = 3 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 3 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = energy_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['ProjectileId'] = '/projectiles/CDFLaserHeavy01/CDFLaserHeavy01_proj.bp'\n",
|
|
" # weapon['BeamCollisionDelay'] = 2\n",
|
|
" # weapon['BeamLifetime'] = 2\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Medium Laser':\n",
|
|
" weapon['Damage'] = 5 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 9 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = energy_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['ProjectileId'] = '/projectiles/CDFLaserHeavy02/CDFLaserHeavy02_proj.bp'\n",
|
|
" # weapon['BeamCollisionDelay'] = 2\n",
|
|
" # weapon['BeamLifetime'] = 2\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Large Laser':\n",
|
|
" weapon['Damage'] = 8 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 15 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = energy_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['ProjectileId'] = '/projectiles/CDFLaserHeavy03/CDFLaserHeavy03_proj.bp'\n",
|
|
" # weapon['BeamCollisionDelay'] = 2\n",
|
|
" # weapon['BeamLifetime'] = 2\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Extended-Range Small Laser':\n",
|
|
" weapon['Damage'] = 3 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 5 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = energy_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['ProjectileId'] = '/projectiles/CDFLaserHeavy01/CDFLaserHeavy01_proj.bp'\n",
|
|
" # weapon['BeamCollisionDelay'] = 2\n",
|
|
" # weapon['BeamLifetime'] = 2\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Extended-Range Medium Laser':\n",
|
|
" weapon['Damage'] = 5 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 12 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = energy_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['ProjectileId'] = '/projectiles/CDFLaserHeavy02/CDFLaserHeavy02_proj.bp'\n",
|
|
" # weapon['BeamCollisionDelay'] = 2\n",
|
|
" # weapon['BeamLifetime'] = 2\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Extended-Range Large Laser':\n",
|
|
" weapon['Damage'] = 8 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 19 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = energy_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['ProjectileId'] = '/projectiles/CDFLaserHeavy03/CDFLaserHeavy03_proj.bp'\n",
|
|
" # weapon['BeamCollisionDelay'] = 2\n",
|
|
" # weapon['BeamLifetime'] = 2\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Small Pulse Laser':\n",
|
|
" weapon['Damage'] = 3 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 3 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = pulse_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['BeamCollisionDelay'] = 0.5\n",
|
|
" weapon['BeamLifetime'] = 0.5\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Medium Pulse Laser':\n",
|
|
" weapon['Damage'] = 6 * damage_mult / 2\n",
|
|
" weapon['MaxRadius'] = 6 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = pulse_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['BeamCollisionDelay'] = 0.5\n",
|
|
" weapon['BeamLifetime'] = 0.5\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Large Pulse Laser':\n",
|
|
" weapon['Damage'] = 9 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 10 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = pulse_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['BeamCollisionDelay'] = 0.5\n",
|
|
" weapon['BeamLifetime'] = 0.5\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Short Range Missiles':\n",
|
|
" weapon['Damage'] = 2 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 9 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = missile_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_LowArc'\n",
|
|
" weapon['WeaponCategory'] = 'Missile'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['ProjectileId'] = '/mods/Supreme Mech Commander 2/projectiles/LRMMissile/LRMMissile_proj.bp'\n",
|
|
" weapon['ProjectileLifetime'] = 10\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Long Range Missiles':\n",
|
|
" weapon['Damage'] = 1 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 21 * range_mult\n",
|
|
" weapon['MinRadius'] = 6 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = missile_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_HighArc'\n",
|
|
" weapon['WeaponCategory'] = 'Missile'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_IndirectFire'\n",
|
|
" weapon['ProjectileId'] = '/mods/Supreme Mech Commander 2/projectiles/LRMMissile/LRMMissile_proj.bp'\n",
|
|
" weapon['ProjectileLifetime'] = 20\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Gauss Rifle':\n",
|
|
" weapon['Damage'] = 15 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 22 * range_mult\n",
|
|
" weapon['MinRadius'] = 2 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Heavy Gauss Rifle':\n",
|
|
" weapon['Damage'] = 25 * damage_mult # FIXME: damage falloff 25/20/10\n",
|
|
" weapon['MaxRadius'] = 20 * range_mult\n",
|
|
" weapon['MinRadius'] = 4 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Light Machine Gun':\n",
|
|
" weapon['Damage'] = 1 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 6 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Machine Gun':\n",
|
|
" weapon['Damage'] = 2 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 3 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Heavy Recoilless Rifle':\n",
|
|
" weapon['Damage'] = 3 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 7 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Claw':\n",
|
|
" weapon['Damage'] = 2 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 2 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" # weapon['FireTargetLayerCapsTable']['Air'] = 'Air'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Land'] = 'Land'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Water'] = 'Water'\n",
|
|
" # weapon['FireTargetLayerCapsTable']['Sub'] = 'Sub'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Seabed'] = 'Seabed'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Short Range Torpedoes':\n",
|
|
" weapon['Damage'] = 2 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 9 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = missile_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Anti Navy'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_AntiNavy'\n",
|
|
" weapon['TargetRestrictDisallow'] = 'UNTARGETABLE, HOVER'\n",
|
|
" # weapon['FireTargetLayerCapsTable']['Air'] = 'Water|Sub|Seabed'\n",
|
|
" # weapon['FireTargetLayerCapsTable']['Land'] = 'Water|Sub|Seabed'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Water'] = 'Water|Sub|Seabed'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Sub'] = 'Water|Sub|Seabed'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Seabed'] = 'Water|Sub|Seabed'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Long Range Torpedoes':\n",
|
|
" weapon['Damage'] = 1 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 21 * range_mult\n",
|
|
" weapon['MinRadius'] = 6 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = missile_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Anti Navy'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_AntiNavy'\n",
|
|
" weapon['TargetRestrictDisallow'] = 'UNTARGETABLE, HOVER'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Air'] = 'Water|Sub|Seabed'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Land'] = 'Water|Sub|Seabed'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Water'] = 'Water|Sub|Seabed'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Sub'] = 'Water|Sub|Seabed'\n",
|
|
" weapon['FireTargetLayerCapsTable']['Seabed'] = 'Water|Sub|Seabed'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Anti Missile System':\n",
|
|
" weapon['Damage'] = 1 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 1 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Defense'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_Countermeasure'\n",
|
|
" weapon['TargetType'] = 'RULEWTT_Projectile'\n",
|
|
" weapon['TargetRestrictOnlyAllow'] = 'TACTICAL MISSILE'\n",
|
|
"\n",
|
|
" luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "56a7499a",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Standardize autocannon weapon stats\n",
|
|
"\n",
|
|
"for filepath in files:\n",
|
|
" blueprint = luadata.read(filepath)\n",
|
|
" \n",
|
|
" if 'Weapon' in blueprint:\n",
|
|
" for weapon in blueprint['Weapon']:\n",
|
|
" if weapon['DisplayName'] == 'Autocannon/2':\n",
|
|
" weapon['Damage'] = 2 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 24 * range_mult\n",
|
|
" weapon['MinRadius'] = 4 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Autocannon/5':\n",
|
|
" weapon['Damage'] = 1 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 18 * range_mult\n",
|
|
" weapon['MinRadius'] = 3 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Autocannon/10':\n",
|
|
" weapon['Damage'] = 10 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 15 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Autocannon/20':\n",
|
|
" weapon['Damage'] = 20 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 9 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'LB 2-X Autocannon':\n",
|
|
" weapon['Damage'] = 1 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 27 * range_mult\n",
|
|
" weapon['MinRadius'] = 4 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'LB 5-X Autocannon':\n",
|
|
" weapon['Damage'] = 1 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 21 * range_mult\n",
|
|
" weapon['MinRadius'] = 3 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'LB 10-X Autocannon':\n",
|
|
" weapon['Damage'] = 1 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 18 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'LB 20-X Autocannon':\n",
|
|
" weapon['Damage'] = 1 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 12 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Ultra Autocannon/2':\n",
|
|
" weapon['Damage'] = 2 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 25 * range_mult\n",
|
|
" weapon['MinRadius'] = 3 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Ultra Autocannon/5':\n",
|
|
" weapon['Damage'] = 5 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 20 * range_mult\n",
|
|
" weapon['MinRadius'] = 2 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Ultra Autocannon/10':\n",
|
|
" weapon['Damage'] = 10 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 18 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Ultra Autocannon/20':\n",
|
|
" weapon['Damage'] = 20 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 10 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Rotary Autocannon/2':\n",
|
|
" weapon['Damage'] = 2 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 18 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Rotary Autocannon/5':\n",
|
|
" weapon['Damage'] = 5 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 15 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" # if weapon['DisplayName'] == 'Rotary Autocannon/10':\n",
|
|
" # if weapon['DisplayName'] == 'Rotary Autocannon/20':\n",
|
|
"\n",
|
|
" luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "3d1cc8e3",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Standardize clan weapon stats\n",
|
|
"\n",
|
|
"for filepath in files:\n",
|
|
" blueprint = luadata.read(filepath)\n",
|
|
" \n",
|
|
" if 'Weapon' in blueprint:\n",
|
|
" for weapon in blueprint['Weapon']:\n",
|
|
" if weapon['DisplayName'] == 'Clan Extended-Range Particle Projector Cannon':\n",
|
|
" weapon['Damage'] = 15 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 23 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['ProjectileId'] = '/projectiles/ADFOblivionCannon03/ADFOblivionCannon03_proj.bp'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Clan Extended-Range Small Laser':\n",
|
|
" weapon['Damage'] = 5 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 6 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = energy_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['ProjectileId'] = '/projectiles/CDFLaserHeavy01/CDFLaserHeavy01_proj.bp'\n",
|
|
" # weapon['BeamCollisionDelay'] = 2\n",
|
|
" # weapon['BeamLifetime'] = 2\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Clan Extended-Range Medium Laser':\n",
|
|
" weapon['Damage'] = 7 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 15 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = energy_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['ProjectileId'] = '/projectiles/CDFLaserHeavy02/CDFLaserHeavy02_proj.bp'\n",
|
|
" # weapon['BeamCollisionDelay'] = 2\n",
|
|
" # weapon['BeamLifetime'] = 2\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Clan Extended-Range Large Laser':\n",
|
|
" weapon['Damage'] = 10 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 25 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = energy_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['ProjectileId'] = '/projectiles/CDFLaserHeavy03/CDFLaserHeavy03_proj.bp'\n",
|
|
" # weapon['BeamCollisionDelay'] = 2\n",
|
|
" # weapon['BeamLifetime'] = 2\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Clan Small Pulse Laser':\n",
|
|
" weapon['Damage'] = 3 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 6 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = pulse_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['BeamCollisionDelay'] = 0.5\n",
|
|
" weapon['BeamLifetime'] = 0.5\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Clan Medium Pulse Laser':\n",
|
|
" weapon['Damage'] = 7 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 12 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = pulse_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['BeamCollisionDelay'] = 0.5\n",
|
|
" weapon['BeamLifetime'] = 0.5\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Clan Large Pulse Laser':\n",
|
|
" weapon['Damage'] = 10 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 20 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = pulse_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['BeamCollisionDelay'] = 0.5\n",
|
|
" weapon['BeamLifetime'] = 0.5\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Clan Gauss Rifle':\n",
|
|
" weapon['Damage'] = 15 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 22 * range_mult\n",
|
|
" weapon['MinRadius'] = 2 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Hyper-Assault Gauss Rifle':\n",
|
|
" weapon['Damage'] = 1 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 24 * range_mult\n",
|
|
" weapon['MinRadius'] = 2 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = ballistic_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_None'\n",
|
|
" weapon['WeaponCategory'] = 'Direct Fire'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Clan Short Range Missiles':\n",
|
|
" weapon['Damage'] = 2 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 9 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = missile_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_LowArc'\n",
|
|
" weapon['WeaponCategory'] = 'Missile'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['ProjectileId'] = '/mods/Supreme Mech Commander 2/projectiles/LRMMissile/LRMMissile_proj.bp'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Clan Long Range Missiles':\n",
|
|
" weapon['Damage'] = 1 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 21 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = missile_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_HighArc'\n",
|
|
" weapon['WeaponCategory'] = 'Missile'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_IndirectFire'\n",
|
|
" weapon['ProjectileId'] = '/mods/Supreme Mech Commander 2/projectiles/LRMMissile/LRMMissile_proj.bp'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Clan Streak Short Range Missiles':\n",
|
|
" weapon['Damage'] = 2 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 9 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = missile_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_LowArc'\n",
|
|
" weapon['WeaponCategory'] = 'Missile'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_DirectFire'\n",
|
|
" weapon['ProjectileId'] = '/mods/Supreme Mech Commander 2/projectiles/LRMMissile/LRMMissile_proj.bp'\n",
|
|
"\n",
|
|
" if weapon['DisplayName'] == 'Clan Streak Long Range Missiles':\n",
|
|
" weapon['Damage'] = 1 * damage_mult\n",
|
|
" weapon['MaxRadius'] = 21 * range_mult\n",
|
|
" weapon['MinRadius'] = 0 * range_mult\n",
|
|
" weapon['MuzzleVelocity'] = missile_velocity\n",
|
|
" weapon['BallisticArc'] = 'RULEUBA_HighArc'\n",
|
|
" weapon['WeaponCategory'] = 'Missile'\n",
|
|
" weapon['RangeCategory'] = 'UWRC_IndirectFire'\n",
|
|
" weapon['ProjectileId'] = '/mods/Supreme Mech Commander 2/projectiles/LRMMissile/LRMMissile_proj.bp'\n",
|
|
"\n",
|
|
" luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "b63faa32",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Cleanup\n",
|
|
"\n",
|
|
"for filepath in files:\n",
|
|
" blueprint = luadata.read(filepath)\n",
|
|
"\n",
|
|
" # blueprint.sort()\n",
|
|
" # blueprint['Air'].sort()\n",
|
|
" # blueprint['Audio'].sort()\n",
|
|
" # blueprint['Buffs']['Regen'].sort()\n",
|
|
" # blueprint['Categories'].sort()\n",
|
|
" # blueprint['Defense'].sort()\n",
|
|
" # blueprint['Display'].sort()\n",
|
|
" # blueprint['Economy'].sort()\n",
|
|
" # blueprint['General'].sort()\n",
|
|
" # blueprint['Intel'].sort()\n",
|
|
" # blueprint['Veteran'].sort()\n",
|
|
"\n",
|
|
" # if 'Weapon' in blueprint:\n",
|
|
" # for weapon in blueprint['Weapon']:\n",
|
|
" # if weapon['MinRadius'] == 0:\n",
|
|
" # weapon.remove('MinRadius')\n",
|
|
" # weapon.sort()\n",
|
|
" \n",
|
|
" # luadata.write(filepath, blueprint, indent=' ', prefix='UnitBlueprint ')"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 71,
|
|
"id": "f545b050",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# luadata fixes\n",
|
|
"\n",
|
|
"for filepath in files:\n",
|
|
" inc = open(filepath, 'r')\n",
|
|
" lines = inc.readlines()\n",
|
|
" inc.close()\n",
|
|
"\n",
|
|
" # gotta replace double quotes with singles\n",
|
|
" for idx, line in enumerate(lines):\n",
|
|
" lines[idx] = line.replace('\\\"', '\\'')\n",
|
|
"\n",
|
|
" # re-add sound class declaration\n",
|
|
" for idx, line in enumerate(lines):\n",
|
|
" for sound in sounds.keys():\n",
|
|
" check = re.match(f\"^(\\s*){sound} = {{\", line)\n",
|
|
" if check is not None:\n",
|
|
" white = check.group(1)\n",
|
|
" lines[idx] = f\"{white}{sound} = Sound {{\\n\"\n",
|
|
"\n",
|
|
" out = open(filepath, 'w')\n",
|
|
" out.writelines(lines)\n",
|
|
" out.close()"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.11.3"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|