def scheme_create(player, name, brand, domain, alliance, cut, sid): if sid in player.tmpschemes: raise Exception("Duplicate SID") if cut < 0 or cut > 100: player.add_msg("Impossible de creer le plan %s, les royaltises %s" % (name, "sont hors limites")) return False sch = scheme(player, name, brand, domain, cut) player.tmpschemes[sid] = sch world.tmpscheme[(player.id, sid)] = sch
def static_create(neutral): laser = weapon('laser', 1, 1, 0, 10, 5) laser.set_accuracy((27, 31, 20, 10, 1, 0, 0, 0, 0, 0)) plasma = weapon('plasma', 2, 1, 1, 5, 8) laser.set_accuracy((1, 5, 13, 20, 30, 20, 10, 0, 0, 0)) uo1 = techno('Usine d\'optimisation I') uo1.base_caracs(I('building'), 10, 0, 5, 3, 5) uo1.add_caracs(I('YOT'), 2) radar1 = techno('Radar I') radar1.base_caracs(I('building'), 100, 500, 10, 50, 10) radar1.add_caracs(I('syst_rad'), 1) radar1.add_caracs(I('fleet_rad'), 1) radar1.add_parents(uo1) sili = techno('Unité de production PCB') sili.base_caracs(I('building'), 10, 0, 10, 10, 5) sili.add_caracs(I('prod_merch'), (I('phys3'), 10)) min1 = techno('Mine I') min1.base_caracs(I('building'), 10, 0, 1, 5, 1) min1.add_caracs(I('extract'), 1) min1.add_caracs(I('cost_merch'), (I('chim1'), 1)) min2 = techno('Mine II') min2.base_caracs(I('building'), 15, 250, 1, 5, 2) min2.add_caracs(I('extract'), 2) min2.add_parents(min1) min3 = techno('Mine III') min3.base_caracs(I('building'), 20, 1000, 1, 5, 3) min3.add_caracs(I('extract'), 3) min3.add_parents(min2) rea1 = techno('Réacteur I') rea1.base_caracs(I('component'), 1, 0, 1, 0, 1) rea1.add_caracs(I('propeller'), 1) rea2 = techno('Réacteur II') rea2.base_caracs(I('component'), 2, 450, 2, 0, 2) rea2.add_caracs(I('propeller'), 3) rea2.add_caracs(I('cost_merch'), (I('chim1'), 1)) rea2.add_parents(rea1) las1 = techno('Laser I') las1.base_caracs(I('component'), 3, 200, 1, 0, 3) las1.add_caracs(I('military'), 1) las1.add_caracs(I('weapon'), (laser, 1, 1)) # weapon, number, coef las1.add_parents(rea1) pla1 = techno('Plasma I') pla1.base_caracs(I('component'), 5, 200, 1, 0, 4) pla1.add_caracs(I('military'), 1) pla1.add_caracs(I('weapon'), (plasma, 1, 1)) # weapon, number, coef pla1.add_parents(las1) pla1.add_parents(rea2) colo = techno('Module de Colonisation') colo.base_caracs(I('component'), 5, 1000, 1, 0, 10) colo.add_caracs(I('colo'), 1) colo.add_parents(rea2) cargo1 = techno('Cargo I') cargo1.base_caracs(I('component'), 2, 250, 1, 0, 2) cargo1.add_caracs(I('cargo'), 10) cargo1.add_parents(rea1) scan1 = techno('Scanner I') scan1.base_caracs(I('component'), 15, 300, 1, 0, 5) scan1.add_caracs(I('syst_rad'), 1) scan1.add_parents(rea1) hscan1 = techno('Hyper-Scanner I') hscan1.base_caracs(I('component'), 15, 400, 1, 0, 7) hscan1.add_caracs(I('fleet_rad'), 1) hscan1.add_parents(scan1) hscan1.add_parents(rea2) mdc1 = techno('Module de Construction I') mdc1.base_caracs(I('component'), 50, 2000, 1, 0, 25) mdc1.add_caracs(I('SCM'), 1) mdc1.add_parents(colo) mdc4 = techno('Module de Construction IV') mdc4.base_caracs(I('component'), 150, 10000, 15, 0, 75) mdc4.add_caracs(I('SCM'), 16) mdc4.add_parents(mdc1) cha1 = scheme(neutral, 'Chasseur Standart', 'Galaxia', I('public'), 0) cha1.add_compo(rea1, 1) cha1.add_compo(las1, 1) cha1.finalize() chal = scheme(neutral, 'Chasseur Lourd', 'Galaxia', I('public'), 0) chal.add_compo(rea2, 1) chal.add_compo(las1, 2) chal.add_compo(pla1, 2) chal.finalize() sco = scheme(neutral, 'Colonisateur Standart', 'Galaxia', I('public'), 0) sco.add_compo(rea1, 1) sco.add_compo(colo, 1) sco.finalize() sonde = scheme(neutral, 'Sonde Standart', 'Galaxia', I('public'), 0) sonde.add_compo(rea1, 1) sonde.add_compo(scan1, 1) sonde.add_compo(hscan1, 1) sonde.finalize() vsous = scheme(neutral, 'Vaisseau Usine', 'Galaxia', I('public'), 0) vsous.add_compo(rea1, 1) vsous.add_compo(mdc1, 1) vsous.finalize() smdc = scheme(neutral, 'mdcIV', 'Galaxia', I('public'), 0) smdc.add_compo(rea1, 1) smdc.add_compo(mdc4, 1) smdc.finalize() croiz = scheme(neutral, 'Croiseur', 'Galaxia', I('public'), 0) croiz.add_compo(rea2, 1) croiz.add_compo(las1, 7) croiz.add_compo(pla1, 8) croiz.finalize() technos = dict() def_ships = dict() for x in locals().itervalues(): if isinstance(x, techno): technos[x.id] = x if isinstance(x, scheme): def_ships[x.name] = x return technos, def_ships