Пример #1
0
def produceEnemy(Database, enemyInfo=None):
    """Produces an Enemy. Creates Random Stats if not given"""
    if not enemyInfo:
        # generate Enemy Information - For the moment only Ships
        enemyInfo = gsp.generateShipInformation(Database)
        # generate Enemy
        enemy = msp.Enemy(enemyInfo)

    # Add Loot Credits
    creds_to_loot = enemy.attackPower() + enemy.shieldStrength()
    enemy.addMoreCredits(creds_to_loot)

    # Loot Goods
    for i in range(random.randint(1, 5)):
        good_to_loot = produceGood(Database)

        enemy.loadCargo(good_to_loot)

    # Random Number
    i = random.randint(0, 100)

    # Enemy Probability
    if i > Database.Universe.EnemyProbability:
        # Lucky you are...
        enemy = None

    return enemy
Пример #2
0
def produceShip(Database, shipInfo=None):
    """Produces a Ship. Creates Random Stats if not given"""
    if not shipInfo:
        # Generate Ship Info
        shipInfo = gsp.generateShipInformation(Database)

    # Create Ship
    ship = msp.Ship(shipInfo)

    return ship