The functions idea is neat. I am coding the easy solution now, just to see that it works and how that would look. So here is the simplest way to implement it:
Code: Select all
function eventResearched(research, structure, player)
{
var cyborgBodies = ['Cyborg Flamer', 'Cyborg Assault Gun', 'Cyborg Rocket', 'Cyborg Cannon',
'Super Tank-Killer Cyborg', 'Super Rail-Gunner', 'Super Pulse Laser Cyborg',
'Super Heavy-Gunner', 'Super HPV Cyborg', 'Super Auto-Cannon Cyborg',
'Super Scourge Cyborg', 'Cyborg Thermite', 'Cyborg Railgun', 'Cyborg Mechanic',
'Cyborg Laser', 'Cyborg Grenadier', 'Combat Engineer', 'Cyborg Anti-Tank'];
var droidBodies = ['Tiger', 'Scorpion', 'Retribution', 'Panther', 'Cobra', 'Bug', 'Retaliation',
'Leopard', 'Viper', 'Dragon', 'Wyvern', 'Mantis', 'Python', 'Vengeance'];
var cyborgHeat = ['Cyborg Thermal Armor', 'Cyborg Thermal Armor Mk2', 'Cyborg Thermal Armor Mk3',
'Cyborg High Intensity Thermal Armor', 'Cyborg High Intensity Thermal Armor Mk2',
'Cyborg High Intensity Thermal Armor Mk3', 'Cyborg Superdense Thermal Armor',
'Cyborg Superdense Thermal Armor Mk2', 'Cyborg Superdense Thermal Armor Mk3'];
var droidHeat = ['Thermal Armor', 'Thermal Armor Mk2', 'Thermal Armor Mk3', 'High Intensity Thermal Armor',
'High Intensity Thermal Armor Mk2', 'High Intensity Thermal Armor Mk3',
'Vehicle Superdense Thermal Armor', 'Vehicle Superdense Thermal Armor Mk2',
'Vehicle Superdense Thermal Armor Mk3'];
var droidPower = ['Fuel Injection Engine', 'Fuel Injection Engine Mk2', 'Fuel Injection Engine Mk3',
'Turbo-Charged Engine', 'Turbo-Charged Engine Mk2', 'Turbo-Charged Engine Mk3',
'Gas Turbine Engine', 'Gas Turbine Engine Mk2', 'Gas Turbine Engine Mk3'];
var droidArmour = ['Composite Alloys', 'Composite Alloys Mk2', 'Composite Alloys Mk3', 'Composite Alloys Mk4',
'Dense Composite Alloys', 'Dense Composite Alloys Mk2', 'Dense Composite Alloys Mk3',
'Superdense Composite Alloys', 'Superdense Composite Alloys Mk2', 'Superdense Composite Alloys Mk3'];
var cyborgArmour = ['Cyborg Composite Alloys', 'Cyborg Composite Alloys Mk2', 'Cyborg Composite Alloys Mk3',
'Cyborg Dense Composite Alloys', 'Cyborg Dense Composite Alloys Mk2',
'Cyborg Dense Composite Alloys Mk3', 'Cyborg Superdense Composite Alloys',
'Cyborg Superdense Composite Alloys Mk2', 'Cyborg Superdense Composite Alloys Mk3'];
if (droidHeat.indexOf(research.fullname) >= 0)
{
for (var i = 0; i < droidBodies.length; i++)
{
Upgrades[player].Body[droidBodies[i]].Thermal += 40;
}
}
if (cyborgHeat.indexOf(research.fullname) >= 0)
{
for (var i = 0; i < droidBodies.length; i++)
{
Upgrades[player].Body[droidBodies[i]].Thermal += 45;
}
}
if (droidPower.indexOf(research.fullname) >= 0)
{
for (var i = 0; i < droidBodies.length; i++)
{
Upgrades[player].Body[droidBodies[i]].Power += 5;
}
}
if (droidArmour.indexOf(research.fullname) >= 0)
{
for (var i = 0; i < droidBodies.length; i++)
{
Upgrades[player].Body[droidBodies[i]].Armour += 30;
Upgrades[player].Body[droidBodies[i]].HitPoints += 30;
}
}
if (cyborgArmour.indexOf(research.fullname) >= 0)
{
for (var i = 0; i < droidBodies.length; i++)
{
Upgrades[player].Body[droidBodies[i]].Armour += 35;
Upgrades[player].Body[droidBodies[i]].HitPoints += 35;
}
}
}
The droidBodies and cyborgBodies arrays should be seen as temporary hacks for now, since I can't get this list with the droid/cyborg distinction intact from anywhere yet. So ignore those.
A very work-in-progress patch is attached in case anyone want to experiment with the design. Note that 'work harder' cheat won't work yet. Probably a lot of other stuff is still broken too. But the basics work now.