Ejemplo n.º 1
0
def printActions():
    actions = dataFiles.Actions
    output = bbc.color("These are actions you can use in this game: \n\n",'orange')
    for action, data in actions.iteritems():
        output += bbc.color(str(action),"green")+": "+data['Description']+"\n"
    showOutput(bbc.bold(output))
    log ("Actions printed")
Ejemplo n.º 2
0
def printActions():
    actions = dataFiles.Actions
    output = bbc.color("These are actions you can use in this game: \n\n",
                       'orange')
    for action, data in actions.iteritems():
        output += bbc.color(str(action),
                            "green") + ": " + data['Description'] + "\n"
    showOutput(bbc.bold(output))
    log("Actions printed")
Ejemplo n.º 3
0
def luckyRoll():
    log ('luck roll!')
    startInventoryUse()
    Char1 = str(window.charList.currentText())
    Char2 = str(window.char2List.currentText())

    luck1 = dataFiles.Characters[Char1]['luck']
    luck2 = dataFiles.Characters[Char2]['luck']

    roll = nodes.roll(1,20,luck1,luck2)

    output = bbc.bold(bbc.color('Luck Roll: ', colorWarn)+str(roll))
    showOutput(output)

    stopInventoryUse()
Ejemplo n.º 4
0
def luckyRoll():
    log('luck roll!')
    startInventoryUse()
    Char1 = str(window.charList.currentText())
    Char2 = str(window.char2List.currentText())

    luck1 = dataFiles.Characters[Char1]['luck']
    luck2 = dataFiles.Characters[Char2]['luck']

    roll = nodes.roll(1, 20, luck1, luck2)

    output = bbc.bold(bbc.color('Luck Roll: ', Colors.warn) + str(roll))
    showOutput(output)

    stopInventoryUse()
    log("Lucky roll done.")
Ejemplo n.º 5
0
def printStats():
    output = ''
    Char1 = str(window.charList.currentText())
    Char2 = str(window.char2List.currentText())

    Ch1 = dataFiles.Characters[Char1]
    Ch2 = dataFiles.Characters[Char2]


    output += bbc.color(Char1+': \n', colorName)
    for key, value in Ch1.iteritems():
        if key != 'inventory':
            output += bbc.color(str(key), colorStat)+": "+str(value)+"; \n"
    output += bbc.color('\n'+Char2+': \n', colorName)
    for key, value in Ch2.iteritems():
        if key != 'inventory':
            output += bbc.color(str(key), colorStat)+": "+str(value)+"; \n"

    output = bbc.bold(output)
    showOutput(output)
Ejemplo n.º 6
0
def printStats():
    #Print characters' stats, all of them for selected chars
    output = ''
    Char1 = str(window.charList.currentText())
    Char2 = str(window.char2List.currentText())

    Ch1 = dataFiles.Characters[Char1]
    Ch2 = dataFiles.Characters[Char2]


    output += bbc.color(Char1+': \n', Colors.names)
    for key, value in Ch1.iteritems():
        if key != 'inventory':
            output += bbc.color(str(key), Colors.stats)+": "+str(value)+"; \n"
    output += bbc.color('\n'+Char2+': \n', Colors.names)
    for key, value in Ch2.iteritems():
        if key != 'inventory':
            output += bbc.color(str(key), Colors.stats)+": "+str(value)+"; \n"

    output = bbc.bold(output)
    showOutput(output)
    log ("Stats printed")
Ejemplo n.º 7
0
def printStats():
    #Print characters' stats, all of them for selected chars
    output = ''
    Char1 = str(window.charList.currentText())
    Char2 = str(window.char2List.currentText())

    Ch1 = dataFiles.Characters[Char1]
    Ch2 = dataFiles.Characters[Char2]

    output += bbc.color(Char1 + ': \n', Colors.names)
    for key, value in Ch1.iteritems():
        if key != 'inventory':
            output += bbc.color(str(key),
                                Colors.stats) + ": " + str(value) + "; \n"
    output += bbc.color('\n' + Char2 + ': \n', Colors.names)
    for key, value in Ch2.iteritems():
        if key != 'inventory':
            output += bbc.color(str(key),
                                Colors.stats) + ": " + str(value) + "; \n"

    output = bbc.bold(output)
    showOutput(output)
    log("Stats printed")
Ejemplo n.º 8
0
def doAction(*args): #main action event handler.
    log ('Action roll!')
    startInventoryUse()
    characterStatus = ''
    actionName = str(window.actionList.currentText())
    actionData = dataFiles.Actions[actionName]
    Char1 = str(window.charList.currentText())
    Char2 = str(window.char2List.currentText())


    #Ch1 and Ch2 store Chars' stats as they were BEFORE action
    Ch1 = dataFiles.Characters[Char1].copy()
    Ch2 = dataFiles.Characters[Char2].copy()

    #region VARIABLES FOR ACTIONS
    missDice = roundTr(nodes.roll(1,1,Ch1['dexterity'], Ch2['dexterity']))
    if missDice == 0:
        missed = True
    else:
        missed = False
    mainDice = nodes.roll(1,20,Ch1['luck'],1)
    weaponDamage = 0
    for item, stats in dataFiles.Characters[Char1]['inventory'].iteritems():
        wd = dataFiles.Characters[Char1]['inventory'][item]['Ch1']['Damage']
        if wd > 0:
            weaponDamage += wd
            log ("Adding damage from weapons: "+str(weaponDamage))
    if mainDice == 20:
        crit = dataFiles.configFile['CritMultiplier']
        critText = bbc.color('CRITICAL HIT! Crit mult:'+str(dataFiles.configFile['CritMultiplier']),Colors.warn)+'\n\n'
    else:
        crit = 1
        critText = ''
    #endregion

    #region Evaluate actions from actionDatabase action
    for attr in dataFiles.AllAttributes:
        if attr == 'Health':
            if dataFiles.Characters[Char1]['Stamina'] > 0:
                influence1 = round(eval(actionData['Ch1'][attr]))
                influence2 = round(eval(actionData['Ch2'][attr]))

                log ("Stamina is above 0, normal damage evaluation: "+str(influence2))
            else:
                log ("Stamina is below  0, divided damage evaluation")
                characterStatus += Char1+ "'s stamina is below 0, damage lowered!"
                influence1 = round(eval(actionData['Ch1'][attr])/10)
                influence2 = round(eval(actionData['Ch2'][attr])/10)
        else:
            log ("Evaluating "+attr+" stat")
            influence1 = round(eval(actionData['Ch1'][attr]))
            influence2 = round(eval(actionData['Ch2'][attr]))

        if (missed and attr != "Stamina"): #If missed skip any influences except for stamina
            log ("Missed, skipping influencing of "+str(attr))
        else:
            log ("Influencing "+str(attr)+": "+str(influence1)+"; "+str(influence2))
            dataFiles.Characters[Char1][attr] += influence1
            dataFiles.Characters[Char2][attr] += influence2
    #endregion

    #region damage items in inventory
    inventoryDamage = ''
    if missed == False:
        print "DAMAGING INVENTORY"
        for item, stats in dataFiles.Characters[Char1]['inventory'].iteritems():
            itemD = round(eval(actionData['Ch1']['itemDamage']),0)
            if itemD != 0:
                itemD = round(itemD/(nodes.roll(1,5,1,1)+1),0) #Randomise damage to different items. Should be replaced with target system
                dataFiles.Characters[Char1]['inventory'][str(item)]['Durability'] += itemD
                inventoryDamage += Char1+"'s "+item+" durability: "+str(dataFiles.Characters[Char2]['inventory'][str(item)]['Durability'])+"("+str(itemD)+"); \n"
        for item, stats in dataFiles.Characters[Char2]['inventory'].iteritems():
            itemD = round(eval(actionData['Ch2']['itemDamage']),0)
            if itemD != 0:
                itemD = round(itemD/(nodes.roll(1,5,1,1)+1),0) #See above
                dataFiles.Characters[Char2]['inventory'][str(item)]['Durability'] += itemD
                inventoryDamage += Char2+"'s "+item+" durability: "+str(dataFiles.Characters[Char2]['inventory'][str(item)]['Durability'])+"("+str(itemD)+"); \n"
    #endregion

    #region cap stats
    for st in dataFiles.cappedStats:
        log ("Capping "+st)
        if dataFiles.Characters[Char1][st] > dataFiles.configFile[st+"Cap"]:
            dataFiles.Characters[Char1][st] = dataFiles.configFile[st+"Cap"]
            log (Char1+"'s "+st+" is capped!")
        if dataFiles.Characters[Char2][st] > dataFiles.configFile[st+"Cap"]:
            dataFiles.Characters[Char2][st] = dataFiles.configFile[st+"Cap"]
            log (Char2+"'s "+st+" is capped!")
    if dataFiles.Characters[Char1]['Arousal'] > dataFiles.configFile["ArousalCap"]:
            dataFiles.Characters[Char1]['Arousal'] = 0.0
            log (Char1+" Orgasmed!")
            characterStatus += bbc.color(Char1+" Orgasmed!\n", 'pink')
    if dataFiles.Characters[Char2]['Arousal'] > dataFiles.configFile["ArousalCap"]:
            dataFiles.Characters[Char2]['Arousal'] = 0.0
            log (Char2+"Orgasmed!")
            characterStatus += bbc.color(Char2+" Orgasmed!\n", 'pink')
    #endregion

    if missed:
        critText += bbc.color("MISS!\n\n", Colors.warn)

    #region Printing output
    if dataFiles.Characters[Char1]['Health'] < -100:
        characterStatus  += bbc.bold(bbc.color(Char1+"'s health dropped below -100! Death suggested!\n", Colors.warn))
    elif dataFiles.Characters[Char1]['Health'] < 0:
        characterStatus  += bbc.bold(bbc.color(Char1+"'s health dropped below 0! KO or Death suggested!\n", Colors.warn))
    else:
        pass
    if dataFiles.Characters[Char2]['Health'] < -100:
        characterStatus  += bbc.bold(bbc.color(Char2+"'s health dropped below -100! Death suggested!\n", Colors.warn))
    elif dataFiles.Characters[Char2]['Health'] < 0:
        characterStatus  += bbc.bold(bbc.color(Char2+"'s health dropped below 0! KO or Death suggested!\n", Colors.warn))
    else: pass

    inventoryReport = stopInventoryUse()

    ch1OutputStats = bbc.color(Char1, Colors.names)+' '+compareStats(Ch1, dataFiles.Characters[Char1])
    ch2OutputStats = bbc.color(Char2, Colors.names)+' '+compareStats(Ch2, dataFiles.Characters[Char2])
    output = bbc.bold("\n"+Char1+" ==> "+actionName+" ==> "+Char2+'\n\n'+str(critText)+str(characterStatus)+str(ch1OutputStats)+'\n'+str(ch2OutputStats)+'\n'+str(inventoryDamage)+'\n'+str(inventoryReport)+'\n\n'+bbc.color('Main Dice Roll: ', Colors.warn)+str(mainDice))
    showOutput(output)
    #log (json.dumps(dataFiles.Characters, sort_keys=True, indent=4, separators=(',', ': ')))
    log('Action roll done!')
Ejemplo n.º 9
0
def doAction(*args):  #main action event handler.
    log('Action roll!')
    startInventoryUse()
    characterStatus = ''
    actionName = str(window.actionList.currentText())
    actionData = dataFiles.Actions[actionName]
    Char1 = str(window.charList.currentText())
    Char2 = str(window.char2List.currentText())

    #Ch1 and Ch2 store Chars' stats as they were BEFORE action
    Ch1 = dataFiles.Characters[Char1].copy()
    Ch2 = dataFiles.Characters[Char2].copy()

    #region VARIABLES FOR ACTIONS
    missDice = roundTr(nodes.roll(1, 1, Ch1['dexterity'], Ch2['dexterity']))
    if missDice == 0:
        missed = True
    else:
        missed = False
    mainDice = nodes.roll(1, 20, Ch1['luck'], 1)
    weaponDamage = 0
    for item, stats in dataFiles.Characters[Char1]['inventory'].iteritems():
        wd = dataFiles.Characters[Char1]['inventory'][item]['Ch1']['Damage']
        if wd > 0:
            weaponDamage += wd
            log("Adding damage from weapons: " + str(weaponDamage))
    if mainDice == 20:
        crit = dataFiles.configFile['CritMultiplier']
        critText = bbc.color(
            'CRITICAL HIT! Crit mult:' +
            str(dataFiles.configFile['CritMultiplier']), Colors.warn) + '\n\n'
    else:
        crit = 1
        critText = ''
    #endregion

    #region Evaluate actions from actionDatabase action
    for attr in dataFiles.AllAttributes:
        if attr == 'Health':
            if dataFiles.Characters[Char1]['Stamina'] > 0:
                influence1 = round(eval(actionData['Ch1'][attr]))
                influence2 = round(eval(actionData['Ch2'][attr]))

                log("Stamina is above 0, normal damage evaluation: " +
                    str(influence2))
            else:
                log("Stamina is below  0, divided damage evaluation")
                characterStatus += Char1 + "'s stamina is below 0, damage lowered!"
                influence1 = round(eval(actionData['Ch1'][attr]) / 10)
                influence2 = round(eval(actionData['Ch2'][attr]) / 10)
        else:
            log("Evaluating " + attr + " stat")
            influence1 = round(eval(actionData['Ch1'][attr]))
            influence2 = round(eval(actionData['Ch2'][attr]))

        if (missed and attr !=
                "Stamina"):  #If missed skip any influences except for stamina
            log("Missed, skipping influencing of " + str(attr))
        else:
            log("Influencing " + str(attr) + ": " + str(influence1) + "; " +
                str(influence2))
            dataFiles.Characters[Char1][attr] += influence1
            dataFiles.Characters[Char2][attr] += influence2
    #endregion

    #region damage items in inventory
    inventoryDamage = ''
    if missed == False:
        print "DAMAGING INVENTORY"
        for item, stats in dataFiles.Characters[Char1]['inventory'].iteritems(
        ):
            itemD = round(eval(actionData['Ch1']['itemDamage']), 0)
            if itemD != 0:
                itemD = round(
                    itemD / (nodes.roll(1, 5, 1, 1) + 1), 0
                )  #Randomise damage to different items. Should be replaced with target system
                dataFiles.Characters[Char1]['inventory'][str(
                    item)]['Durability'] += itemD
                inventoryDamage += Char1 + "'s " + item + " durability: " + str(
                    dataFiles.Characters[Char2]['inventory'][str(
                        item)]['Durability']) + "(" + str(itemD) + "); \n"
        for item, stats in dataFiles.Characters[Char2]['inventory'].iteritems(
        ):
            itemD = round(eval(actionData['Ch2']['itemDamage']), 0)
            if itemD != 0:
                itemD = round(itemD / (nodes.roll(1, 5, 1, 1) + 1),
                              0)  #See above
                dataFiles.Characters[Char2]['inventory'][str(
                    item)]['Durability'] += itemD
                inventoryDamage += Char2 + "'s " + item + " durability: " + str(
                    dataFiles.Characters[Char2]['inventory'][str(
                        item)]['Durability']) + "(" + str(itemD) + "); \n"
    #endregion

    #region cap stats
    for st in dataFiles.cappedStats:
        log("Capping " + st)
        if dataFiles.Characters[Char1][st] > dataFiles.configFile[st + "Cap"]:
            dataFiles.Characters[Char1][st] = dataFiles.configFile[st + "Cap"]
            log(Char1 + "'s " + st + " is capped!")
        if dataFiles.Characters[Char2][st] > dataFiles.configFile[st + "Cap"]:
            dataFiles.Characters[Char2][st] = dataFiles.configFile[st + "Cap"]
            log(Char2 + "'s " + st + " is capped!")
    if dataFiles.Characters[Char1]['Arousal'] > dataFiles.configFile[
            "ArousalCap"]:
        dataFiles.Characters[Char1]['Arousal'] = 0.0
        log(Char1 + " Orgasmed!")
        characterStatus += bbc.color(Char1 + " Orgasmed!\n", 'pink')
    if dataFiles.Characters[Char2]['Arousal'] > dataFiles.configFile[
            "ArousalCap"]:
        dataFiles.Characters[Char2]['Arousal'] = 0.0
        log(Char2 + "Orgasmed!")
        characterStatus += bbc.color(Char2 + " Orgasmed!\n", 'pink')
    #endregion

    if missed:
        critText += bbc.color("MISS!\n\n", Colors.warn)

    #region Printing output
    if dataFiles.Characters[Char1]['Health'] < -100:
        characterStatus += bbc.bold(
            bbc.color(
                Char1 + "'s health dropped below -100! Death suggested!\n",
                Colors.warn))
    elif dataFiles.Characters[Char1]['Health'] < 0:
        characterStatus += bbc.bold(
            bbc.color(
                Char1 + "'s health dropped below 0! KO or Death suggested!\n",
                Colors.warn))
    else:
        pass
    if dataFiles.Characters[Char2]['Health'] < -100:
        characterStatus += bbc.bold(
            bbc.color(
                Char2 + "'s health dropped below -100! Death suggested!\n",
                Colors.warn))
    elif dataFiles.Characters[Char2]['Health'] < 0:
        characterStatus += bbc.bold(
            bbc.color(
                Char2 + "'s health dropped below 0! KO or Death suggested!\n",
                Colors.warn))
    else:
        pass

    inventoryReport = stopInventoryUse()

    ch1OutputStats = bbc.color(Char1, Colors.names) + ' ' + compareStats(
        Ch1, dataFiles.Characters[Char1])
    ch2OutputStats = bbc.color(Char2, Colors.names) + ' ' + compareStats(
        Ch2, dataFiles.Characters[Char2])
    output = bbc.bold("\n" + Char1 + " ==> " + actionName + " ==> " + Char2 +
                      '\n\n' + str(critText) + str(characterStatus) +
                      str(ch1OutputStats) + '\n' + str(ch2OutputStats) + '\n' +
                      str(inventoryDamage) + '\n' + str(inventoryReport) +
                      '\n\n' + bbc.color('Main Dice Roll: ', Colors.warn) +
                      str(mainDice))
    showOutput(output)
    #log (json.dumps(dataFiles.Characters, sort_keys=True, indent=4, separators=(',', ': ')))
    log('Action roll done!')