def test_get_monster_amir(self, _):
     actual = monster.get_monster()
     expected = {
         "HP": [10, 10],
         'name': 'Amir',
         'attack': 'Amir rolls your name on his magic device!',
         'type': 'monster'
     }
     self.assertEqual(actual, expected)
 def test_get_monster_frank(self, _):
     actual = monster.get_monster()
     expected = {
         "HP": [10, 10],
         'name': 'Frank',
         'attack': 'Frank assigns an assignment that\'s 100% fun!',
         'type': 'monster'
     }
     self.assertEqual(actual, expected)
 def test_get_monster_chris(self, _):
     actual = monster.get_monster()
     expected = {
         "HP": [1000, 1000],
         'name': 'Chris',
         'attack': 'Chris says "see?  wasn\'t so hard was it?"',
         'type': 'monster'
     }
     self.assertEqual(actual, expected)
 def test_get_monster_armaan(self, _):
     actual = monster.get_monster()
     expected = {
         "HP": [10, 10],
         'name': 'Armaan',
         'attack':
         'Armaan says: Studies show students learn best when pushed to the edge!',
         'type': 'monster'
     }
     self.assertEqual(actual, expected)
Пример #5
0
def start_combat(character):
    """
    Run an instance of combat.
    :param character: A dictionary representing a character.
    :precondition: Provide the function with a proper argument as stated in the param above.
    :postcondition: The character will fight a monster until one of them dies.
    """
    enemy = monster.get_monster()
    player_first = roll_for_initiative()
    while game.is_alive(enemy) and game.is_alive(character):
        if player_first:
            combat_round(character, enemy)
        else:
            combat_round(enemy, character)
    if game.is_alive(character):
        print("You outlasted your instructor!")
        character["in_combat"] = False
        game.play(character)
    else:
        print("Game over!  You did not manage to survive school.")
Пример #6
0
import os
import pygame
from monster import get_monster
from items import get_water, get_foodstuff, get_medicine, get_weapon

# Color palette:
COLOR_DARKEST   = (26, 14, 5)
COLOR_DARK      = (50, 31, 19)
COLOR_LIGHT     = (130, 102, 84)
COLOR_LIGHTEST  = (203, 163, 136)

# Tile
TILE_W = TILE_H = 32
DEFAULT_MONSTER_LIST = [get_monster("rattlesnake"), get_monster("small_scorpion"),
        get_monster("big_scorpion"), get_monster("road_runner"),
        get_monster("coyote"), get_monster("camel"), get_monster("skink")]
DEFAULT_FOOD_LIST = [get_foodstuff("cactus_piece")]
DEFAULT_HYDRATION_LIST = [get_water("water_bottle")]
DEFAULT_MEDICINE_LIST = [get_medicine("antidote")]
DEFAULT_WEAPON_LIST = [get_weapon("stick"), get_weapon("sharp_rock"),
        get_weapon("pointy_stick")]

OASIS_MONSTER_LIST = DEFAULT_MONSTER_LIST + [get_monster("crocodile")]

CAMP_FOOD_LIST = [get_foodstuff("cactus_piece"), get_foodstuff("granola_bar")]
CAMP_WEAPON_LIST = [get_weapon("plusone_mace")]

PYRAMID_WEAPON_LIST = [get_weapon("warped_blade")]


# Character: