예제 #1
0
class EnemySoldier(EnemyMale):
    def __init__(self, game, name, (x, y)):
        BasicUnit.__init__(self, game, name, 'player', (x, y))
        self.name = name
        self.anim_name = "player"
        self.hostile = True
        self.playable = False
        self.ally = False
        self.has_special = False
        self.palette_swaps.update({
            (128, 128, 64): (128, 128, 128),
            (128, 64, 0): (128, 128, 128)
        })
        self.equipment = [
            equipment.make(game, 'iron_chain_mail'),
            equipment.make(game, 'iron_sword'),
            equipment.make(game, 'iron_shield'),
            equipment.Hairpiece(game, 'Hair', 'hairpiece'),
            equipment.make(game, 'helm_of_suck')
        ]
        self.inventory = []
        self.activities = [
            'standing', 'walking', 'attacking', 'falling', 'dead', 'stunned'
        ]
        self.current_activity = 'standing'
        self.animations = []
        self.current_hp = self.max_hp = 90
        self.min_damage = 6
        self.max_damage = 8
        self.mitigation = 0.1
        self.avoidance = 0.2
        self.load_animations(game, self.palette_swaps)
        self.reset(game)
예제 #2
0
class EnemyOfficer(EnemyMale):
    def __init__(self, game, name, (x, y)):
        BasicUnit.__init__(self, game, name, 'player', (x, y))
        self.name = name
        self.anim_name = "player"
        self.hostile = True
        self.playable = False
        self.ally = False
        self.has_special = False
        self.palette_swaps.update({
            (128, 128, 64): (192, 192, 192),
            (128, 64, 0): (192, 192, 192),
            (0, 0, 0): (64, 64, 64)
        })
        #hair
        self.equipment = [
            equipment.make(game, 'iron_chain_mail'),
            equipment.make(game, 'iron_sword'),
            equipment.make(game, 'iron_shield'),
            equipment.Hairpiece(game, 'Hair', 'hairpiece'),
            equipment.make(game, 'officer_helm')
        ]
        self.inventory = []
        self.activities = [
            'standing', 'walking', 'attacking', 'falling', 'dead',
            'decapitated', 'dead_decapitated'
        ]
        self.current_activity = 'standing'
        self.animations = []
        self.max_hp = 100
        self.current_hp = self.max_hp
        self.load_animations(game, self.palette_swaps)
        self.reset(game)
예제 #3
0
class EnemyBandit(EnemySoldier):
    def __init__(self, game, name, (x, y)):
        BasicUnit.__init__(self, game, name, 'player', (x, y))
        self.vision_radius = 12
        self.hostile = True
        self.playable = False
        self.ally = False
        self.has_special = False
        self.palette_swaps.update({(0, 0, 128): (90, 60, 0)})
        equip_palette_swaps = {
            (128, 64, 0): (128, 0, 128),
            (128, 128, 128): (192, 128, 0),
            (192, 192, 192): (255, 255, 0)
        }
        self.equipment = [
            equipment.make(game, 'sword_of_suck'),
            equipment.make(game, 'brown_bandit_tunic'),
            equipment.Hairpiece(game, 'Hair of Suck', 'hairpiece'),
            equipment.make(game, 'brown_bandit_crown'),
            equipment.make(game, 'green_bandit_shield')
        ]
        self.current_hp = self.max_hp = 90
        self.avoidance = 0.3
        self.mitigation = 0
        self.min_damage = 6
        self.max_damage = 8
        self.activities = [
            'standing', 'walking', 'attacking', 'falling', 'dead',
            'decapitated', 'dead_decapitated'
        ]
        self.current_activity = 'standing'
        self.animations = []
        self.load_animations(game, self.palette_swaps)
        self.reset(game)
예제 #4
0
class SoldierNPC(EnemyMale):
    # contains the core code for JickerNPC
    # ally = false by default, just switch it to true to make them follow you
    def __init__(self, game, name, (x, y)):
        BasicUnit.__init__(self, game, name, 'player', (x, y))
        self.name = name
        self.anim_name = "player"
        self.hostile = False
        self.playable = False
        self.ally = False
        self.has_special = False
        self.palette_swaps.update({(128, 64, 0): (0, 0, 255)})
        (self.x, self.y) = (x, y)
        #hair
        r = random.randint(0, 192)
        g = random.randint(int(r * 0.5), int(r * 0.9))
        b = random.randint(int(r * 0.1), int(r * 0.2))
        self.equipment = [
            equipment.make(game, 'blue_chain_mail'),
            equipment.make(game, 'sword_of_suck'),
            equipment.make(game, 'iron_shield'),
            equipment.Hairpiece(game, 'Hair', 'hairpiece'),
            equipment.make(game, 'helm_of_suck')
        ]
        self.inventory = []
        self.activities = [
            'standing', 'walking', 'attacking', 'falling', 'dead',
            'decapitated', 'dead_decapitated', 'stunned'
        ]
        self.current_activity = 'standing'
        self.animations = []
        self.max_hp = 100
        self.current_hp = self.max_hp
        self.load_animations(game, self.palette_swaps)
        self.reset(game)
예제 #5
0
class JickerNPC(SoldierNPC):
    def __init__(self, game, name, (x, y)):
        BasicUnit.__init__(self, game, name, 'player', (x, y))
        self.hostile = False
        self.playable = False
        self.ally = True
        self.has_special = False
        self.palette_swaps.update({
            (128, 128, 64): (50, 100, 150),
            (128, 64, 0): (64, 48, 32),
            (128, 128, 0): (64, 48, 32),
            (0, 64, 64): (64, 48, 32)
        })
        self.equipment = [
            equipment.make(game, 'jick'),
            equipment.Hairpiece(game, 'Hair', 'hairpiece')
        ]
        self.inventory = []
        self.activities = [
            'standing', 'walking', 'attacking', 'falling', 'dead',
            'decapitated', 'dead_decapitated', 'stunned'
        ]
        self.current_activity = 'standing'
        self.animations = []
        self.max_hp = 100
        self.current_hp = self.max_hp
        self.load_animations(game, self.palette_swaps)
        self.reset(game)
예제 #6
0
class RockThrowingPeasant(WaypointedCivilian):
    def __init__(self, game, name, (x, y), waypoints):
        BasicUnit.__init__(self, game, name, 'player', (x, y))
        self.name = name
        self.anim_name = 'player'
        self.hostile = False
        self.playable = False
        self.ally = False
        self.has_special = False
        self.palette_swaps.update({
            (128, 64, 0): (64, 32, 0),
            (0, 0, 0): (128, 64, 0)
        })
        self.equipment = [
            equipment.Hairpiece(game, "Hair of Suck", "hairpiece")
        ]
        self.inventory = []
        self.activities = [
            'standing', 'walking', 'attacking', 'falling', 'dead',
            'decapitated', 'dead_decapitated', 'stunned', 'throwing'
        ]
        self.current_activity = 'standing'
        self.animations = []
        self.current_hp = self.max_hp = 60
        self.avoidance = self.mitigation = 0
        self.waypoints = waypoints
        self.load_animations(game, self.palette_swaps)
        self.reset(game)
예제 #7
0
class MayorNPC(BasicFriendlyNPC):
    def __init__(self, game, name, (x, y)):
        BasicUnit.__init__(self, game, name, 'player', (x, y))
        self.name = name
        self.anim_name = 'player'
        self.hostile = False
        self.playable = False
        self.ally = False
        self.has_special = False
        self.palette_swaps = {}
        self.equipment = [
            equipment.Hairpiece(game, "Gray Hair", "hairpiece",
                                {(0, 0, 0): (128, 128, 128)}),
            equipment.Hairpiece(game, "Gray Beard", "beard",
                                {(0, 0, 0): (128, 128, 128)}),
            equipment.make(game, "helm_of_suck"),
            equipment.make(game, "blue_tunic")
        ]
        self.inventory = []
        self.activities = [
            'standing', 'walking', 'attacking', 'falling', 'dead',
            'decapitated', 'dead_decapitated', 'stunned'
        ]
        self.current_activity = 'standing'
        self.animations = []
        self.max_hp = 100
        self.current_hp = self.max_hp
        self.load_animations(game, self.palette_swaps)
        self.reset(game)
        self.quest_given = False
예제 #8
0
파일: npcs.py 프로젝트: jwbutler/rpg5
class JickerPeasant(SoldierNPC):
  #Used in town levels
  def __init__(self, game, name, (x, y)):
    BasicUnit.__init__(self, game, name, 'player', (x,y))
    self.name = name
    self.anim_name = "player"
    self.hostile = False
    self.playable = False
    self.ally = False
    self.has_special = False
    self.palette_swaps.update({(128,64,0): (128,128,128)})
    (self.x,self.y) = (x,y)
    self.activities = ['standing', 'walking', 'attacking', 'falling', 'dead', 'stunned']
    self.equipment = [equipment.Spear(self.game, "Jick", "spear", self.activities,
                        {(192,192,192):(178,96,32), (85,43,0):(178,96,32), (128,128,128):(100, 60, 20)}),
                      equipment.Cloak(self.game, 'Cloak', 'cloak', self.activities,
                        {(0,0,0):(64,32,16), (128,128,128):(128,64,32), (255,0,0):(128,64,32), (255,128,64):(64,32,16)})
                     ]
    #hair
    r = random.randint(0, 192)
    g = random.randint(int(r*0.5), int(r*0.9))
    b = random.randint(int(r*0.1), int(r*0.2))
    hair = equipment.Hairpiece(self.game, 'Hair', 'hairpiece', self.activities, {(0,0,0):(r,g,b)})
    self.equipment.append(hair)
    if random.random() < 0.25:
      self.equipment.append(equipment.Beard(self.game, 'Beard', self.activities, hair.palette_swaps))
    self.current_activity = 'standing'
    self.animations = []
    self.current_hp = self.max_hp = 70
    self.avoidance = self.mitigation = 0
    self.min_damage = 3; self.max_damage = 5
    self.load_animations(self.palette_swaps)
    self.reset()
    self.flee_threshold = 0.75
예제 #9
0
class BasicFriendlyNPC(EnemyMale, PlayerMale):
    def __init__(self, game, name, (x, y)):
        BasicUnit.__init__(self, game, name, 'player', (x, y))
        self.name = name
        self.anim_name = 'player'
        self.hostile = False
        self.playable = False
        self.ally = False
        self.has_special = False
        self.palette_swaps.update({
            (128, 64, 0): (64, 32, 0),
            (0, 0, 0): (128, 64, 0)
        })
        self.equipment = [
            equipment.Hairpiece(game, "Hair of Suck", "hairpiece")
        ]
        self.inventory = []
        self.activities = [
            'standing', 'walking', 'attacking', 'falling', 'dead',
            'decapitated', 'dead_decapitated', 'stunned'
        ]
        self.current_activity = 'standing'
        self.animations = []
        self.current_hp = self.max_hp = 80
        self.avoidance = self.mitigation = 0
        self.current_hp = self.max_hp
        self.load_animations(game, self.palette_swaps)
        self.reset(game)
예제 #10
0
파일: npcs.py 프로젝트: jwbutler/rpg5
class SoldierNPC(EnemyMale):
  # contains the core code for JickerNPC
  # ally = false by default, just switch it to true to make them follow you
  # usurping this class for jickers in townlol
  def __init__(self, game, name, (x, y)):
    BasicUnit.__init__(self, game, name, 'player', (x,y))
    self.name = name
    self.anim_name = "player"
    self.hostile = False
    self.playable = False
    self.ally = False
    self.has_special = False
    self.palette_swaps.update({(128,64,0): (0,0,255)})
    (self.x,self.y) = (x,y)
    self.activities = ['standing', 'walking', 'attacking', 'falling', 'dead', 'stunned']
    self.equipment = [equipment.Armor(self.game, "Blue Chain Mail", "mail", self.activities, {(128,128,128):(0,0,192)}),
                      equipment.Sword(self.game, "Sword of Suck", "sword", self.activities),
                      equipment.Helm(self.game, "Blue Helmet", "helm2", self.activities, {(128,128,128):(0,0,192)}),
                     ]
    #hair
    r = random.randint(0, 192)
    g = random.randint(int(r*0.5), int(r*0.9))
    b = random.randint(int(r*0.1), int(r*0.2))
    hair = equipment.Hairpiece(self.game, 'Hair', 'hairpiece', self.activities, {(0,0,0):(r,g,b)})
    self.equipment.append(hair)
    if random.random() < 0.25:
      self.equipment.append(equipment.Beard(self.game, 'Beard', self.activities, hair.palette_swaps))
    self.current_activity = 'standing'
    self.animations = []
    self.current_hp = self.max_hp = 70
    self.avoidance = self.mitigation = 0
    self.min_damage = 3; self.max_damage = 6
    self.load_animations(self.palette_swaps)
    self.reset()
    self.flee_threshold = 0.5
예제 #11
0
class RedWizard(EnemyWizard, EnemyMale):
    def __init__(self, game, name, (x, y)):
        BasicUnit.__init__(self, game, name, 'robed_wizard', (x, y))
        self.hostile = True
        self.playable = False
        self.has_special = False
        self.palette_swaps = {
            (58, 58, 58): (192, 0, 0),
            (192, 192, 192): (255, 128, 64),
            (128, 128, 128): (128, 0, 0)
        }
        self.equipment = []
        self.inventory = []
        self.activities = [
            'standing', 'walking', 'casting', 'falling', 'dead', 'teleporting',
            'appearing', 'stunned'
        ]
        self.current_activity = 'standing'
        self.animations = []
        self.max_hp = 600
        self.current_hp = self.max_hp
        self.evade_speed = 0.7
        self.fireball_ticks = 0
        self.max_fireball_ticks = 10
        self.teleport_ticks = 0
        self.max_teleport_ticks = 40
        self.target_x = self.target_y = self.target_unit = None
        self.zombies = []
        self.load_animations(self.palette_swaps)
        self.reset()
예제 #12
0
class EnemyBandit(EnemySoldier):
    def __init__(self, game, name, (x, y)):
        t1 = pygame.time.get_ticks()
        BasicUnit.__init__(self, game, name, 'player', (x, y))
        self.vision_radius = 12
        self.hostile = True
        self.playable = False
        self.ally = False
        self.has_special = False
        self.activities = [
            'standing', 'walking', 'attacking', 'falling', 'dead', 'stunned'
        ]
        self.palette_swaps.update({(0, 0, 128): (90, 60, 0)})
        equip_palette_swaps = {
            (128, 64, 0): (128, 0, 128),
            (128, 128, 128): (192, 128, 0),
            (192, 192, 192): (255, 255, 0)
        }
        self.equipment = [
            equipment.Sword(self.game, "Sword", 'sword', self.activities),
            equipment.Armor(self.game, "Brown Bandit Tunic", "mail",
                            self.activities, {
                                (128, 128, 128): (128, 64, 0),
                                (0, 0, 0): (85, 43, 0)
                            }),
            equipment.Helm(
                self.game, 'Brown Bandit Crown', 'crown', self.activities, {
                    (128, 128, 128): (128, 64, 0),
                    (0, 0, 0): (85, 43, 0),
                    (192, 192, 192): (215, 216, 43)
                })
        ]
        hairpiece = equipment.Hairpiece(self.game, 'Hair', 'hairpiece',
                                        self.activities)
        self.equipment.append(hairpiece)
        if random.random() <= 0.25:
            self.equipment.append(
                equipment.Beard(self.game, 'Beard', self.activities,
                                hairpiece.palette_swaps))
        self.current_hp = self.max_hp = 80
        self.avoidance = 0
        self.mitigation = 0
        self.min_damage = 4
        self.max_damage = 7
        self.evade_speed = 0.4

        self.current_activity = 'standing'
        self.animations = []
        self.load_animations(self.palette_swaps)
        self.reset()
        t2 = pygame.time.get_ticks()
        if self.game.debug: print "Bandit load time:", t2 - t1, "ms"
예제 #13
0
class EnemyBanditClub(EnemyBandit):
    def __init__(self, game, name, (x, y)):
        t1 = pygame.time.get_ticks()
        BasicUnit.__init__(self, game, name, 'player', (x, y))
        self.vision_radius = 12
        self.hostile = True
        self.playable = False
        self.ally = False
        self.has_special = False
        self.palette_swaps.update({
            (0, 0, 128): (90, 60, 0),
            (128, 128, 64): self.skin_color,
            (0, 0, 0): self.skin_color,
            (128, 128, 0): self.skin_color,
            (192, 192, 192): self.skin_color
        })
        self.activities = [
            'standing', 'walking', 'attacking_club', 'falling', 'dead',
            'stunned'
        ]
        self.equipment = [
            equipment.Sword(self.game, "Club", "club", self.activities),
            equipment.Cloak(
                self.game, 'Cloak', 'cloak', self.activities, {
                    (0, 0, 0): (64, 64, 64),
                    (128, 128, 128): (128, 128, 64),
                    (255, 0, 0): (128, 128, 64),
                    (255, 128, 64): (64, 64, 64)
                })
        ]
        hairpiece = equipment.Hairpiece(self.game, 'Hair', 'hairpiece',
                                        self.activities)
        self.equipment.append(hairpiece)
        if random.random() <= 0.75:
            self.equipment.append(
                equipment.Beard(self.game, 'Beard', self.activities,
                                hairpiece.palette_swaps))

        self.current_hp = self.max_hp = 100
        self.avoidance = 0
        self.mitigation = 0
        self.min_damage = 10
        self.max_damage = 16
        self.evade_speed = 0.2
        self.current_activity = 'standing'
        self.animations = []
        self.load_animations(self.palette_swaps)
        self.reset()
        t2 = pygame.time.get_ticks()
        if self.game.debug: print "Banditclub load time:", t2 - t1, "ms"
예제 #14
0
class EnemyBanditVar(EnemyBandit):
    def __init__(self, game, name, (x, y)):
        t1 = pygame.time.get_ticks()
        BasicUnit.__init__(self, game, name, 'player', (x, y))
        self.vision_radius = 12
        self.hostile = True
        self.playable = False
        self.ally = False
        self.has_special = False
        self.palette_swaps.update({(0, 0, 128): (90, 60, 0)})
        self.activities = [
            'standing', 'walking', 'attacking', 'falling', 'dead', 'stunned'
        ]
        self.equipment = [
            equipment.Sword(self.game, "Steel Sword", "sword", self.activities,
                            {
                                (128, 128, 128): (189, 191, 193),
                                (192, 192, 192): (234, 229, 229)
                            }),
            equipment.Helm(self.game, 'Crown', 'crown', self.activities),
            equipment.Shield(
                self.game, "Green Bandit Shield", "shield2", self.activities, {
                    (128, 128, 128): (128, 128, 0),
                    (192, 192, 192): (170, 190, 90),
                    (0, 0, 0): (100, 140, 100)
                }),
            equipment.Armor(self.game, 'Chain Mail', 'mail', self.activities)
        ]
        hairpiece = equipment.Hairpiece(self.game, 'Hair', 'hairpiece',
                                        self.activities)
        self.equipment.append(hairpiece)
        if random.random() <= 0.5:
            self.equipment.append(
                equipment.Beard(self.game, 'Beard', self.activities,
                                hairpiece.palette_swaps))

        self.current_hp = self.max_hp = 80
        self.avoidance = 0.3
        self.mitigation = 0
        self.min_damage = 5
        self.max_damage = 8
        self.evade_speed = 0.4
        self.current_activity = 'standing'
        self.animations = []
        self.load_animations(self.palette_swaps)
        self.reset()
        t2 = pygame.time.get_ticks()
        if self.game.debug: print "Banditvar load time:", t2 - t1, "ms"
예제 #15
0
파일: npcs.py 프로젝트: jwbutler/rpg5
class RockThrowingPeasantChick(RockThrowingPeasant, PlayerFemale):
  # Phase out WaypointedCivilian entirely? There's a ton of C/P here
  def __init__(self, game, name, (x, y), waypoints):
    t1 = pygame.time.get_ticks()
    BasicUnit.__init__(self, game, name, 'female', (x,y))
    self.name = name
    self.anim_name = 'female'
    self.hostile = False
    self.playable = False
    self.ally = False
    self.has_special = False
    self.palette_swaps.update({(128,64,0):(64,32,0), (0,0,0):(128,64,0)})
    self.activities = ['standing', 'walking', 'falling', 'dead', 'stunned', 'throwing']
    self.equipment = []
    self.inventory = []
    self.current_activity = 'standing'
    self.animations = []
    self.current_hp = self.max_hp = 40
    self.avoidance = self.mitigation = 0
    self.waypoints = waypoints
    self.load_animations(self.palette_swaps)
    self.reset()
    t2 = pygame.time.get_ticks()
    if self.game.debug: print "Rock thrower girl load time:", t2-t1
예제 #16
0
from __future__ import division
import pygame
import random
# We should always do imports this way
from units import BasicUnit, EnemyMale
from functions import palette_swap, palette_swap_multi, get_slash_directions, distance, obstacle, obstacle_unit
from classes import Animation, Pointer, Corpse, HealthPowerup


class EnemyZombie(EnemyMale):
    # aka weak zombie
    def __init__(self, game, name, (x, y), palette_swaps=None):
        BasicUnit.__init__(self, game, name, 'zombie', (x, y))
        self.hostile = True
        self.playable = False
        self.ally = False
        self.has_special = False
        if palette_swaps:
            self.palette_swaps = palette_swaps
        else:
            #clothes
            r = random.randint(80, 160)
            g = random.randint(80, 160)
            b = random.randint(80, 160)
            clothes_color = (r, g, b)
            #skin
            r = random.randint(180, 230)
            g = random.randint(int(r * 0.6), int(r * 0.9))
            b = random.randint(int(r * 0.6), int(r * 0.9))
            skin_color = (r, g, b)
            self.palette_swaps = {