bigmodifier=2
smallmodifier=1.5

modify '<Talent identifier="ballastdenizen">!anyvalue="(?<holdbreathmultiplier>!num)"!anyCharacterAbilityGiveStat stattype="HoldBreathMultiplier" value="(?<holdbreathmultiplierv>!num)"' \
'holdbreathmultiplier=round(holdbreathmultiplier*2, 2)
holdbreathmultiplierv=round(holdbreathmultiplier/100, 2)' \
**/TalentsMechanic.xml

modify '<Talent identifier="engineengineer">!anyvalue="(?<enginemaxspeedperlevel>!num)"!anyvalue="(?<enginemaxspeedmaxvalue>!num)"!anyvalue="(?<enginemaxspeedv>!num)"!anyvalue="(?<enginemaxspeedv2>!num)"!anyvalue="(?<enginemaxspeedv3>!num)"!anyvalue="(?<enginemaxspeedv4>!num)"!anyvalue="(?<enginemaxspeedv5>!num)"!anyvalue="(?<enginemaxspeedv6>!num)"!anyvalue="(?<enginemaxspeedv7>!num)"!anyvalue="(?<enginemaxspeedv8>!num)"' \
"enginemaxspeedperlevel=round(enginemaxspeedperlevel*$bigmodifier, 2)
enginemaxspeedmaxvalue=round(enginemaxspeedmaxvalue*$bigmodifier, 2)
enginemaxspeedv=round(1+enginemaxspeedperlevel/100, 2)
enginemaxspeedv2=round(1+2*enginemaxspeedperlevel/100, 2)
enginemaxspeedv3=round(1+3*enginemaxspeedperlevel/100, 2)
enginemaxspeedv4=round(1+4*enginemaxspeedperlevel/100, 2)
enginemaxspeedv5=round(1+5*enginemaxspeedperlevel/100, 2)
enginemaxspeedv6=round(1+6*enginemaxspeedperlevel/100, 2)
enginemaxspeedv7=round(1+7*enginemaxspeedperlevel/100, 2)
enginemaxspeedv8=round(1+8*enginemaxspeedperlevel/100, 2)" \
**/TalentsMechanic.xml

modify '<Talent identifier="machinemaniac"!anyamount!anyamount!anyvalue="(?<mechanicalskillbonus>!num)"!anyxpamount!anyvalue="(?<xpbonus>!num)"!anylevel!anyvalue="(?<levelbonus>!num)"!anyamount!anyvalue="(?<repairspeed>!num)"!anyCharacterAbilityGiveExperience amount="(?<experiencev>!num)"!anyCharacterAbilityGivePermanentStat stattype="MechanicalSkillBonus"!anyvalue="(?<mechanicalskillbonusv>!num)"!anyCharacterAbilityUpgradeSubmarine!anylevel="(?<levelv>!num)"!anyCharacterAbilityGivePermanentStat stattype="MechanicalRepairSpeed"!anyvalue="(?<repairspeedv>!num)"' \
"mechanicalskillbonus=round(mechanicalskillbonus*$smallmodifier, 2)
xpbonus=round(xpbonus*$bigmodifier, 2)
levelbonus=round(levelbonus*2, 2)
repairspeed=round(repairspeed*$bigmodifier, 2)
experiencev=xpbonus
levelv=levelbonus
mechanicalskillbonusv=mechanicalskillbonus
repairspeedv=round(repairspeed/100, 2)" \
**/TalentsMechanic.xml

modify '<Talent identifier="multifunctional">!anyvalue="(?<addeddamagemultiplier>!num)"!anyaddeddamagemultiplier="(?<addeddamagemultiplierv>!num)"' \
"addeddamagemultiplier=round(addeddamagemultiplier*$smallmodifier, 2)
addeddamagemultiplierv=round(addeddamagemultiplier/100, 2)" \
**/TalentsMechanic.xml

modify '<Talent identifier="salvagecrew">!anyvalue="(?<xpbonus>!num)"!anyswimbonus!anyvalue="(?<swimbonus>!num)"!anyvalue="(?<resistanceamount>!num)"!anymultiplyvalue="(?<xpbonusv>!num)"' \
"xpbonus=round(xpbonus*$bigmodifier, 2)
swimbonus=round(swimbonus*$bigmodifier, 2)
resistanceamount=round(resistanceamount*$smallmodifier, 2)
xpbonusv=round(1+xpbonus/100, 2)" \
**/TalentsMechanic.xml
modify '<Affliction!anyidentifier="salvagecrew"!anyminresistance="(?<minresistance>!num)"!anymaxresistance="(?<maxresistance>!num)"!anySwimmingSpeed!anyvalue="(?<swimmingspeed>!num)"' \
"minresistance=round(minresistance*$smallmodifier, 2)
maxresistance=round(maxresistance*$smallmodifier, 2)
swimmingspeed=round(swimmingspeed*$bigmodifier, 2)" \
**/AfflictionsMechanic.xml

modify '<Talent identifier="modularrepairs">!anylevel!anyvalue="(?<levelbonus>!num)"!anylevel="(?<levelbonusv>!num)"!anylevel="(?<levelbonusv2>!num)"' \
"levelbonus=round(levelbonus*2, 2)
levelbonusv=levelbonus
levelbonusv2=levelbonus" \
**/TalentsMechanic.xml

modify '<Talent identifier="oiledmachinery">!anyvalue="(?<fabricationspeed>!num)"!anyFabricationSpeed" value="(?<fabricationspeedv>!num)"!anyDeconstructorSpeed" value="(?<deconstructorspeedv>!num)"' \
"fabricationspeed=round(fabricationspeed*$bigmodifier, 2)
fabricationspeedv=round(fabricationspeed/100, 2)
deconstructorspeedv=round(fabricationspeed/100, 2)" \
**/TalentsMechanic.xml

modify '<Talent identifier="pumpndump">!anyvalue="(?<pumpspeed>!num)"!anyPumpSpeed" value="(?<pumpspeedv>!num)"' \
"pumpspeed=round(pumpspeed*3, 2)
pumpspeedv=round(1+pumpspeed/100, 2)" \
**/TalentsMechanic.xml

# Not obvious what this does
# "Unlock hull upgrades as if your submarine is one tier higher. Does not stack with multiple of the same talent."
modify '<Talent identifier="retrofit">!anyvalue="(?<walllevel>!num)"' \
"walllevel=round(walllevel*1, 2)" \
**/TalentsMechanic.xml

modify '<Talent identifier="miner">!anyvalue="(?<doubleyieldchance>!num)"!anyvalue="(?<miningspeed>!num)"!anyvalue="(?<miningspeedv>!num)"!anyrandomchance="(?<doubleyieldchancev>!num)"' \
"doubleyieldchance=round(doubleyieldchance*3.5, 2)
miningspeed=round(miningspeed*2, 2)
miningspeedv=round(1+miningspeed/100, 2)
doubleyieldchancev=round(doubleyieldchance/100, 2)" \
**/TalentsMechanic.xml

modify '<Talent identifier="massproduction">!anyvalue="(?<doublechance>!num)"!anyrandomChance="(?<doublechancev>!num)"' \
"doublechance=round(doublechance*1.45, 2)
doublechancev=round(doublechance/100, 2)" \
**/TalentsMechanic.xml

modify '<Talent identifier="residualwaste">!anyvalue="(?<doublechance>!num)"!anyrandomChance="(?<doublechancev>!num)"' \
"doublechance=round(doublechance*3.45, 2)
doublechancev=round(doublechance/100, 2)" \
**/TalentsMechanic.xml

modify '<Talent identifier="scrapsavant">!anyvalue="(?<doublechance>!num)"!anymultiplyvalue="(?<scrapmultiplier>!num)"!anyrandomchance="(?<doublechancev>!num)"' \
"doublechance=round(doublechance*3.45, 2)
scrapmultiplier=round(scrapmultiplier*1.5, 2)
doublechancev=round(doublechance/100, 2)" \
**/TalentsMechanic.xml

modify '<Talent identifier="toolmaintenance">!anyvalue="(?<qualitybonus>!num)"!anyvalue="(?<qualitybonusv>!num)"!anyvalue="(?<qualitybonusv2>!num)"' \
"qualitybonus=round(qualitybonus*2, 2)
qualitybonusv=qualitybonus
qualitybonusv2=qualitybonus" \
**/TalentsMechanic.xml

modify '<Talent identifier="hullfixer">!anyvalue="(?<repairtoolstructurerepairmultiplier>!num)"!anyvalue="(?<repairtoolstructurerepairmultiplierv>!num)"' \
"repairtoolstructurerepairmultiplier=round(repairtoolstructurerepairmultiplier*$bigmodifier, 2)
repairtoolstructurerepairmultiplierv=round(repairtoolstructurerepairmultiplier/100, 2)" \
**/TalentsMechanic.xml

# TODO: This also crashes modify...
modify '<Talent identifier="quickfixer">!anyvalue="(?<movementspeed>!num)"!anyvalue="(?<duration>!num)"!anyvalue="(?<repairspeed>!num)"!anyamount="(?<durationv>!num)"' \
"movementspeed=round(movementspeed*$smallmodifier, 2)
duration=round(duration*$bigmodifier, 2)
repairspeed=round(repairspeed*$bigmodifier, 2)
durationv=duration" \
**/TalentsMechanic.xml
# TODO: This also produces a weird bug, it's probably due to indices
modify '<Affliction!anyidentifier="quickfixer"!anyvalue="(?<movementspeedv>!num)"' \
"movementspeedv=round(movementspeedv*$smallmodifier, 2)" \
**/AfflictionsMechanic.xml

modify '<Talent identifier="tinkerer">!anyvalue="(?<maxrepairconditionmultipliermechanical>!num)"!anyvalue="(?<maxrepairconditionmultipliermechanicalv>!num)"' \
"maxrepairconditionmultipliermechanical=round(maxrepairconditionmultipliermechanical*2.5, 2)
maxrepairconditionmultipliermechanicalv=round(maxrepairconditionmultipliermechanical/100, 2)" \
**/TalentsMechanic.xml

modify '<Talent identifier="letitdrain">!anyvalue="(?<maxpumps>!num)"!anyvalue="(?<maxpumpsv>!num)"' \
"maxpumps=round(maxpumps*2, 2)
maxpumpsv=maxpumps" \
**/TalentsMechanic.xml

modify '<Talent identifier="robotics">!anyvalue="(?<maxdrones>!num)"' \
"maxdrones=round(maxdrones*2, 2)" \
**/TalentsMechanic.xml
modify '<Item!anyidentifier="defensebotspawner"!anytotalmaxcount="(?<maxdronesv>!num)"' \
"maxdronesv=round(maxdronesv*2, 2)" \
**/mechanic_talent_items.xml

modify '<Talent identifier="iamthatguy">!anyvalue="(?<damagebonus>!num)"!anyvalue="(?<skillbonus>!num)"!anySkillBonus" value="(?<skillbonusv>!num)"!anyaddedmultiplier="(?<damagebonusv>!num)"' \
"damagebonus=round(damagebonus*$smallmodifier, 2)
skillbonus=round(skillbonus*$smallmodifier, 2)
skillbonusv=skillbonus
damagebonusv=round(damagebonus/100, 2)" \
**/TalentsMechanic.xml

modify '<Talent identifier="heavylifting">!anyvalue="(?<movementspeed>!num)"!anyvalue="(?<movementspeedv>!num)"' \
"movementspeed=round(movementspeed*$smallmodifier, 2)
movementspeedv=round(movementspeed/100, 2)" \
**/TalentsMechanic.xml

modify '<Talent identifier="mudraptorwrestler">!anyvalue="(?<addeddamage>!num)"!anyvalue="(?<bonusresistance>!num)"!anyaddeddamagemultiplier="(?<addeddamagev>!num)"!anyCharacterAbilityGiveResistance resistanceid="damage" multiplier="(?<bonusresistancev>!num)"' \
"addeddamage=round(addeddamage*$smallmodifier, 2)
addeddamagev=round(addeddamage/100, 2)
bonusresistance=round(bonusresistance*$smallmodifier, 2)
bonusresistancev=round(1-bonusresistance/100, 2)" \
**/TalentsMechanic.xml

modify '<Talent identifier="berserker">!anyvalue="(?<hpthreshold>!num)"!anyvalue="(?<damagebonus>!num)"!anyvitalitypercentage="(?<hpthresholdv>!num)"' \
"hpthreshold=round(hpthreshold*1.37, 2)
damagebonus=round(damagebonus*$smallmodifier, 2)
hpthresholdv=round(hpthreshold/100, 2)" \
**/TalentsMechanic.xml
modify '<Affliction!anyidentifier="berserker"!anyvalue="(?<meleedamage>!num)"' \
"meleedamage=round(meleedamage*$smallmodifier, 2)" \
**/AfflictionsMechanic.xml

modify '<Talent identifier="foolhardy">!anyvalue="(?<hpthreshold>!num)"!anyvalue="(?<resistancebonus>!num)"!anyvitalitypercentage="(?<hpthresholdv>!num)"' \
"hpthreshold=round(hpthreshold*1.37, 2)
resistancebonus=round(resistancebonus*$smallmodifier, 2)
hpthresholdv=round(hpthreshold/100, 2)" \
**/TalentsMechanic.xml
modify '<Affliction!anyidentifier="foolhardy"!anyresistancefor="damage" minresistance="(?<minresistance>!num)" maxresistance="(?<maxresistance>!num)"' \
"minresistance=round(minresistance*$bigmodifier, 2)
maxresistance=round(maxresistance*$bigmodifier, 2)" \
**/AfflictionsMechanic.xml

# MECHanic is missing but I can't find its id...