def __init__(self, world, image):
        # initialize the base constructor for this class
        GameEntity.__init__(self, world, "glowing_one", image)
        self.dead_image = pygame.transform.rotate(image, 90)
        
        self.glowing_one_characteristic = [10, 10, 10, 2, 2, 2, -1]
        self.glowing_one_mod = [0, 0, 0, 0, 0, 0, 0]
        
        def update_glowing_one_dm(glowing_one_mod):
            for i in range(7):
                glowing_one_mod[i] = char_dm[self.glowing_one_characteristic[i]]
                
        self.glowing_one_characteristic[c_Str] = roll('2d6') + 6
        self.glowing_one_characteristic[c_Dex] = roll('2d6') + 6
        self.glowing_one_characteristic[c_End] = roll('2d6') + 6
        #print self.glowing_one_characteristic[0:3]
        update_glowing_one_dm(self.glowing_one_mod)
        #print self.glowing_one_mod[0:3]
        #print
        self.initial_health = sum(self.glowing_one_characteristic[:3])
        self.current_health = randint(5, self.initial_health)
        
        # create instances for each state
        exploring_state = Glowing_One_StateExploring(self)
        seeking_state = Glowing_One_StateSeeking(self)
        healing_state = Glowing_One_StateHealing(self)
#         delivering_state = GhoulStateDelivering(self)
#         hunting_state = GhoulStateHunting(self)
        
        # add the states to the state machine (self.brain)
        self.brain.add_state(exploring_state)
        self.brain.add_state(seeking_state)
        self.brain.add_state(healing_state)
 def check_conditions(self):
     if roll('3d6') == 18:
         self.ghoul.current_health += 1
     # if healed, continue exploring
     if self.ghoul.current_health < self.ghoul.initial_health * .5:
         return None
     return "exploring"
Exemplo n.º 3
0
#
#   Written for Python 2.5.4
#
#   Run this file to call roll()
#

"""
Performs 10 dice rolls
"""

from program.diceroll import roll
from program import version

print
print 'Welcome to', version.ver
print
dice = raw_input("Enter roll type, such as 3D6: ")
print 'Here are your ten', dice, 'rolls:'

for i in range(10):
    print roll(dice)
 def entry_actions(self):
     # give glowing one random speed and heading
     self.glowing_one.speed = 20 + roll('FLUX') * 3
     self.random_destination()
 def do_actions(self):
     # 1 in 20 chance of changing directions
     if roll('d100') == 1:
         self.random_destination()
 def entry_actions(self):
     # give ghoul random speed and heading
     self.ghoul.speed = 20 + roll('FLUX') * 3
     self.random_destination()
from pygame.locals import *
from gameobjects.vector2 import Vector2
from random import randint
import time
import program
from program.diceroll import roll

def update_dm(characteristic_mod):
    for i in range(7):
        characteristic_mod[i] = char_dm[characteristic[i]]
        
characteristic = [0, 0, 0, 0, 0, 0, -1]
characteristic_mod = [0, 0, 0, 0, 0, 0, 0]
char_dm = [-3, -2, -2, -1, -1, -1, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]
for i in range(6):
    characteristic[i] = roll('2D6')
update_dm(characteristic_mod)

char_dm = [-3, -2, -2, -1, -1, -1, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]

c_Str = 0
c_Dex = 1
c_End = 2
c_Int = 3
c_Edu = 4
c_Soc = 5
c_Psi = 6
        

class State:
    def __init__(self, name):