Пример #1
0
    def check_if_caught(self):
        position_difference = self._hunter_position_x - Vampire.get_x()

        if (((self.moving_dir == 'right' and position_difference >= -240
              and position_difference <= 0) or
             (self.moving_dir == 'left' and position_difference <= 240
              and position_difference >= 0)) and not Vampire.hidden_status()):
            pygame.quit()
Пример #2
0
    def createCharacter(self, teamNum):
        print("Pick Team %s Character by selecting from below: \n" % teamNum)
        print("1) Vampire\n")
        print("2) Barbarian\n")
        print("3) BlueMen\n")
        print("4) Medusa\n")
        print("5) HarryPotter\n\n")

        choice = 0

        while choice !=1 and choice != 2 and choice != 3 and choice != 4 and choice != 5:
            try:
                choice = int(input("Input the character number that you select:  "))
            except:
                choice = 0

        characterName = input("Enter character name:  ")

        if choice is 1:
            character = Vampire(characterName)
            return character

        elif choice is 2:
            character = Barbarian(characterName)
            return character

        elif choice is 3:
            character = BlueMen(characterName)
            return character

        elif choice is 4:
            character = Medusa(characterName)
            return character

        elif choice is 5:
            character = HarryPotter(characterName)
            return character
Пример #3
0
def test_it_has_a_name():
    """Vampires are given names when they are created."""
    vampire = Vampire("Dracula")
    assert vampire.name == "Dracula"
Пример #4
0
def test_it_is_not_thirsty_after_drinking():
    """After it drinks it is not thirsty anymore."""
    vampire = Vampire("Elizabeth Bathory")
    vampire.drink()
    assert vampire.is_thirsty() is False
Пример #5
0
def test_it_is_thirsty_by_default():
    """Vampires are thirsty by default."""
    vampire = Vampire("Count von Count")
    assert vampire.is_thirsty() is True
Пример #6
0
def test_it_can_have_other_pets():
    """Can have a different kind of pet."""
    vampire = Vampire("Varney", "fox")
    assert vampire.pet == "fox"
Пример #7
0
def test_it_keeps_a_pet_bat_by_default():
    """Defaults to having a pet bat."""
    vampire = Vampire("Ruthven")
    assert vampire.pet == "bat"
Пример #8
0
def test_it_is_named_something_else():
    """Vampires can have different names."""
    vampire = Vampire("Vladimir")
    assert vampire.name == "Vladimir"
def vamp_file():
    vamp_file = Vampire.new_Vampire_from_file("file_name_here")
    yield vamp_file
Пример #10
0
    while run:

        if int(time()) % 5 == 0 and len(ai) < 3:
            ai.append(Pedestrian())

        Screen.load()

        deletion_list = []

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                run = False
            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_RIGHT:
                    Vampire.change_pos('right')
                elif event.key == pygame.K_LEFT:
                    Vampire.change_pos('left')
                elif event.key == pygame.K_SPACE:
                    for bot in ai:
                        if Vampire.is_close_to_vampire(bot):
                            deletion_list.append(bot)
                            score_value += 1
                elif event.key == pygame.K_LALT:
                    Vampire.hide_if_near_dumpster()

            elif event.type == pygame.KEYUP:
                if (event.key == pygame.K_RIGHT or event.key == pygame.K_LEFT):
                    Vampire.change_pos('stop')

        for bot in ai:
Пример #11
0
    elif new_game == "N":
        print "What a shame. Perhaps one day thou wilst become a hero.\n"

    else:
        print "That is not a valid input.\n"

hero_name = raw_input("What is thy name, bold adventurer? \n")
the_hero = Hero(hero_name)
hero_home = raw_input("Whence dost thou hail, brave %s? \n") % the_hero.name

print "Well, %s of %s, I hope you are prepared. \n" % (the_hero.name,
                                                       the_hero.home)

monsters = []
monsters.append(Goblin())
monsters.append(Vampire())
monsters.append(Ogre())

for monster in monsters:
    #	 print "1. 1 enemy"
    #	 print "2. 2 enemies"
    #	 print "3. 3 enemies"
    #	 enemies_num = raw_input("How many enemies do you want to fight? ")
    #	 if enemies_num == "1":
    #	 	monsters[0]

    print "\n"
    print "Mighty hero %s, you have encountered a %s. \n" % (the_hero.name,
                                                             monster.name)
    if monster == Ogre:
        monster.ogre_cry()
Пример #12
0
from vampire import Vampire

# test out the class
dracula = Vampire.create("Dracula", 600)
deacon = Vampire.create("Deacon", 150)
balthazar = Vampire.create("Balthazar", 250)
anton = Vampire.create("Anton", 25)
# send everyone home first
for vampire in Vampire.coven:
    vampire.go_home()
# see the result
print("Before sunset:")
for vampire in Vampire.coven:
    print(
        "*", "Name: {}\t In Coffin: {}\t Drank Blood Today: {}".format(
            vampire.name, vampire.in_coffin, vampire.drank_blood_today))
# let the night begin
Vampire.sunset()
print()
print("After sunset:")
# check the difference
for vampire in Vampire.coven:
    print(
        "*", "Name: {}\t In Coffin: {}\t Drank Blood Today: {}".format(
            vampire.name, vampire.in_coffin, vampire.drank_blood_today))
dracula.drink_blood()
dracula.go_home()
deacon.drink_blood()
deacon.go_home()
print()
print("When the night is over:")
# from [file name] import [class]
from hero import Hero
# There can only be one hero
from goblin import Goblin
# There are many, many goblins!
from vampire import Vampire

hero_name = raw_input("What is your name? ")
the_Hero = Hero(hero_name, 10)

while the_Hero.is_alive:
    randMonster = randint(1,2)
    if randMonster ==1:
        monster = Goblin()
    else:
        monster = Vampire()
    while(the_Hero.is_alive() and monster.is_alive()): # main game loop
        print "Welcome %s, you steamy turd!" % hero_name
        print "You have encountered a %s" % monster.name
        # Run the game while BOTH the hero and the goblin have health > 0
        while the_Hero.health > 0 and monster.health > 0:
            message = """
            You have %d health and %d power.
            The monster has %d health and %d power. 
            What do you want to do?
            1. Fight!
            2. Dance!
            3. Fleeeeeeeeee!
            > """ 
            print message % (the_Hero.health, the_Hero.power, monster.health, monster.power)
            
def vamp():
    vamp = Vampire.new_Vampire()
    attr = vamp.keys_attributes[1]
    vamp.set_attribute(attr, 2)
    yield vamp
def test_vampire_skill_default():
    vamp = Vampire().get_skill("Firearms")
    if vamp != None:
        assert True
    else:
        assert False
from vampire import Vampire

dracula = Vampire.create('Dracula', 122)  #Alive
nosferatu = Vampire.create('Nosferatu', 97)
blade = Vampire.create('Blade', 90)  #Alive
barnabas = Vampire.create('Barnabas Collins', 175)
von_count = Vampire.create('Count von Count', 1832652)  #Alive
print()

# Vampire.list_all_vampires()
print()

Vampire.sunset()

print(dracula.drink_blood())
print(dracula.go_home())

print(nosferatu.go_home())

print(barnabas.go_home())

print(von_count.drink_blood())

Vampire.sunrise()
print()

Vampire.list_all_vampires()
Пример #17
0
print("*** GAME START ***")

pug = Troll('Pug')
print("Ugly Troll - {}".format(pug))

ug = Troll('Ug')
print("Another Troll - {}".format(ug))

urg = Troll('Urg')
print(urg)

pug.grunt()
ug.grunt()
urg.grunt()

drakula = Vampire('drakula')
print(drakula)

pug.take_damage(2)
print(pug)

drakula.take_damage(2)
print(drakula)

while drakula._alive:
    drakula.take_damage(1)
    #print(drakula)

super_draku = VampireKing('KING D.')
print(super_draku)
while super_draku._alive: