예제 #1
0
    def random_rotation(self):
        rotations = [
            {
                'rotation': Rotation.CLOCKWISE,
                'degrees': 90,
                'rotations': 0
            },
            {
                'rotation': Rotation.CLOCKWISE,
                'degrees': 90,
                'rotations': 1
            },
            {
                'rotation': Rotation.COUNTER_CLOCKWISE,
                'degrees': 90,
                'rotations': 2
            },
            {
                'rotation': Rotation.COUNTER_CLOCKWISE,
                'degrees': 90,
                'rotations': 3
            },
        ]

        rotation = rotations[roll_die(len(rotations), 20)]
        return rotation
예제 #2
0
    def roll_income(self):
        if self.value < 1:
            return 0

        roll = roll_die(100)['result']
        outcome = self.map_roll_to_outcome(roll)
        income = self.determine_income(outcome, self.value)
        return {"roll": roll, "outcome": outcome, "income": income}
예제 #3
0
 def random_shape(self):
     shapes = {}
     
     shapes[0]=IShape
     shapes[1]=TShape
     shapes[2]=LShapeRight
     shapes[3]=LShapeLeft
     shapes[4]=ZShapeRight
     shapes[5]=ZShapeLeft   
     shapes[6]=SquareShape
     
     return shapes[roll_die(len(shapes), 20)](self.random_background(), (40,40), None)        
예제 #4
0
def calculate_direction():
    dir_map = {
        1: "NorthWest",
        2: "North",
        3: "NorthEast",
        4: "West",
        5: "East",
        6: "SouthEast",
        7: "South",
        8: "SouthWest"
    }
    roll = roll_die(8)['result']
    return dir_map[roll]
예제 #5
0
    def determine_income(self, outcome, value):
        percentage_map = {}
        percentage_map[DISASTER] = -1.0
        percentage_map[DECLINE] = -0.33
        percentage_map[VERY_SLOW] = -0.15
        percentage_map[SLOW] = 0
        percentage_map[NORMAL] = 0.15
        percentage_map[GREAT] = 0.33
        percentage_map[SPECTACULAR] = 0.5
        percentage_map[BOOMING] = 1.0

        income = 0

        if outcome in percentage_map:
            income = float(value) * float(percentage_map[outcome])

        if outcome == DISASTER:
            bonus_percentage = float(roll_die(100)['result']) / float(100)
            income += float(value) * float(bonus_percentage)
        elif outcome == BOOMING:
            bonus_percentage = float(roll_die(100)['result']) / float(100)
            income += float(value) * float(bonus_percentage)
        return income
예제 #6
0
 def attack(self):
     attack_power = int(self.strength / 2)
     roll = roll_die(max(attack_power, 1))['result']
     return min(roll, self.strength)
예제 #7
0
 def random_degrees(self):
     degrees = [90, 180, 270, 360]
     return degrees[roll_die(len(degrees), 20)]
예제 #8
0
 def random_rotation(self):
     rotations = [Rotation.CLOCKWISE, Rotation.COUNTER_CLOCKWISE]
     return rotations[roll_die(len(rotations), 20)]
예제 #9
0
# imports
from dice import roll_die
from Data import Specialties, Characteristic_Aptitudes, Characteristic_Prices, CharacteristicLevel, SSkill_Aptitudes
from Functions import *

import Character
import math

# skillVars
heretic = False  # IT BETTER BE
char = Character.PlayerChar()

# generating characteristics:
counter = 0
for skill in char.Characteristic:
    fd = roll_die(10)
    sd = roll_die(10)
    dr = fd + sd
    sv = char.Characteristic[skill] + dr
    char.Characteristic[skill] = sv
    print(
        str(counter) + ": " + str(skill) + " " + str(sv) + "(" + str(fd) +
        "|" + str(sd) + ") " + " CB: " + str(int(sv / 10)))
    counter = counter + 1
print("")

print("Please enter the number of the line you would like to re-roll")
print("if you are happy with what the emperor has given you, enter 9")
reRoll = input()
print("")
예제 #10
0
def calculate_distance():
    roll = roll_die(8)['result']
    return roll * 5
예제 #11
0
 def random_background(self):
     return self.colors[roll_die(len(self.colors), 20)]