示例#1
0
def showMissGraph():
    rollsNum = graphDialog.rollsNumberSB.value()
    Char1 = str(window.charList.currentText())
    Char2 = str(window.char2List.currentText())
    actionData = dataFiles.Actions[str(window.actionList.currentText())]

    data1 = []
    data2 = []
    Ch1 = dataFiles.Characters[Char1].copy()
    Ch2 = dataFiles.Characters[Char2].copy()

    for x in range (0,rollsNum):
        missDice = round(nodes.roll(1,1,Ch1['dexterity'], Ch2['dexterity']),0)+3
        missDice2 = round(nodes.roll(1,1,Ch2['dexterity'], Ch1['dexterity']),0)
        print missDice, missDice2
        data1.append(missDice)
        data2.append(missDice2)

    graphDialog.pGraph.clear()
    graphDialog.pGraph.plot(data1, pen='r')
    graphDialog.pGraph.plot(data2, pen='b')
示例#2
0
def showMissGraph():
    rollsNum = graphDialog.rollsNumberSB.value()
    Char1 = str(window.charList.currentText())
    Char2 = str(window.char2List.currentText())
    actionData = dataFiles.Actions[str(window.actionList.currentText())]

    data1 = []
    data2 = []
    Ch1 = dataFiles.Characters[Char1].copy()
    Ch2 = dataFiles.Characters[Char2].copy()

    for x in range(0, rollsNum):
        missDice = roundTr(nodes.roll(1, 1, Ch1['dexterity'],
                                      Ch2['dexterity'])) + 3
        missDice2 = roundTr(
            nodes.roll(1, 1, Ch2['dexterity'], Ch1['dexterity']))
        print missDice, missDice2
        data1.append(missDice)
        data2.append(missDice2)

    graphDialog.pGraph.clear()
    graphDialog.pGraph.plot(data1, pen='r')
    graphDialog.pGraph.plot(data2, pen='b')
    log("Miss graph plotted.")
示例#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()
示例#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.")
示例#5
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!')
示例#6
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!')