def SimulatedDukeItOut (fgname,faction,enfgname,enfaction): ally=fg_util.LandedShipsInFG(fgname,faction) enemy=fg_util.LandedShipsInFG(enfgname,enfaction) if (len(enemy) and len(ally)): allyvictim = vsrandom.randrange(0,len(ally)) allystats = faction_ships.GetStats(ally[allyvictim][0]) envictim = vsrandom.randrange(0,len(enemy)) enstats = faction_ships.GetStats(enemy[envictim][0]) endam = HowMuchDamage(enemy,vsrandom.uniform(0,allystats[1])) if (enfgname==fgname and enfaction==faction): debug.error("FAULT FAULT FAULT") ApplyDamage(enfgname,enfaction,enemy,envictim,enstats,HowMuchDamage(ally,vsrandom.uniform(0,enstats[1])),fgname,faction) ApplyDamage(fgname,faction,ally,allyvictim,allystats,endam,enfgname,enfaction)
def LaunchEqualShips (fgname, faction, enfgname, enfaction): debug.debug("DYNAMO*3") land=fg_util.LandedShipsInFG(fgname,faction) launch=fg_util.ShipsInFG(fgname,faction) enland=fg_util.LandedShipsInFG(enfgname,enfaction) enlaunch=fg_util.ShipsInFG(enfgname,enfaction) numenland=countTn(enland) numenlaunch=countTn(enlaunch) numland=countTn(land) numlaunch=countTn(launch) if (numenland==0 or numland==0 or (numlaunch==0 and numenlaunch==0) ): return if (numlaunch/numland > numenlaunch/numenland): LaunchMoreShips (fgname,faction,land,int((numland*numenlaunch/numenland)-numlaunch)) else: LaunchMoreShips (enfgname,enfaction,enland,int((numenland*numlaunch/numland)-numenlaunch))
def launch_dockable_around_unit(fg, faction, ai, radius, myunit, garbage_collection_distance, logo='', fgappend='', skipdj=0): import fg_util for i in fg_util.LandedShipsInFG(fg, faction): if (i[0] == 'Mule.stock' or i[0] == 'Mule' or faction_ships.isCapital(i[0])): un = launch_types_around(fg, faction, [i], ai, radius, myunit, garbage_collection_distance, logo, fgappend, skipdj) if (un.isDockableUnit()): return un if (fgappend == 'Base'): fg = fgappend else: fg = fg + fgappend return launch.launch_wave_around_unit( fg, faction, faction_ships.getRandomCapitol(faction), ai, 1, radius, radius * 1.5, myunit, logo, 1, skipdj)