def __init__(self, id, x, y, tileLoader, tileSize, taskList: TaskList):
        Creature.__init__(self, id, x, y, tileLoader, tileSize, 3)
        self.image = tileLoader.getTileFromName("mapTiles", 3)
        self.pos: Vector2 = Vector2(x, y)
        self.path = []
        self.tileSize = tileSize
        self.roamNode = None
        self.zoneToGoTo = 0

        # Creature stats, used in the tamgotchi life thing
        self.needs = Needs()
        self.brain.pushState(self.roaming)

        #Creature skills. Used to calculate how good a creature is at something
        self.skills = ClergyRobotSkills()

        # Flags for FSM stuff
        self.foundFoodPOI: PointOfInterest = None
        self.foundPoIIndex = -1
        self.foundBedPOI: PointOfInterest = None

        self.time = 0

        self.taskList = taskList

        self.currentTask: Task = None

        self.converted = True  # Can be romoved, just to debug humans
Example #2
0
 def __init__(self, x, y):
     
     Creature.__init__(self, x, y, KRAKEN_SPEED, KRAKEN_LIFE, KRAKEN_REGENERATION, 2)
     
     self.attack = KRAKEN_ATTACK
     self.attackSpeed = KRAKEN_ATTACK_SPEED
     
     self.lastAttack = 0
     
     self.image = loadImage("art/kraken.png", (255,255,255))
Example #3
0
    def __init__(self, x, y, tileLoader, tileSize, task):
        Creature.__init__(self, None, x, y, tileLoader, tileSize, 3)
        self.image = tileLoader.getTileFromName("mapTiles", 6)
        self.positionToGoTo: Vector2 = task.placeToGo
        self.lifeTask: WaitTask = task
        self.brain.pushState(self.walkingToState)
        self.alive = True
        self.converted = False

        # The humans skills, mostly for converting
        self.skills: HumanSkills = HumanSkills()
Example #4
0
 def __init__(self, x, y, team):
     
     Creature.__init__(self, x, y, ARCHER_SPEED, ARCHER_LIFE, ARCHER_REGENERATION, team)
     
     self.attack = ARCHER_ATTACK
     self.attackSpeed = ARCHER_ATTACK_SPEED
     
     self.lastAttack = 0
     
     if self.team == 0:
         self.image = loadImage("art/greek_archer.png", (255,255,255))
     else:
         self.image = loadImage("art/egytian_archer.png", (255,255,255))
 def __init__(self, x, y, team):
     
     Creature.__init__(self, x, y, SWORDSMAN_SPEED, SWORDSMAN_LIFE, SWORDSMAN_REGENERATION, team)
     
     self.attack = SWORDSMAN_ATTACK
     self.attackSpeed = SWORDSMAN_ATTACK_SPEED
     
     self.lastAttack = 0
     
     if self.team == 0:
         self.image = loadImage("art/greek_swordsman.png", (255,255,255))
     else:
         self.image = loadImage("art/egyptian_swordsman.png", (255,255,255))
Example #6
0
 def __init__(self, x, y, team):
     
     Creature.__init__(self, x, y, WIZARD_SPEED, WIZARD_LIFE, WIZARD_REGENERATION, team)
     
     self.attack = WIZARD_ATTACK
     self.attackSpeed = WIZARD_ATTACK_SPEED
     
     self.lastAttack = 0
     
     self.movement = 0
     
     if self.team == 0:
         self.image = loadImage("art/wizard.png", (255,255,255))
     else:
         self.image = loadImage("art/egyptian_magician.png", (255,255,255))
Example #7
0
    def __init__(self, x=0, y=0, theta=0):
        """
        Constructor
        """
        Creature.__init__(self, x, y, theta)

        self.gradL = GradientSniffer(self, self.world, -10)
        self.senses.append((self.gradL))

        self.gradC = GradientSniffer(self, self.world, 0)
        self.senses = self.senses.append(self.gradC)

        self.gradR = GradientSniffer(self, self.world, 10)
        self.senses.append(self.gradR)

        self.brain_data = ArrayInterface([("gradR", 1), ("gradC", 1), ("gradL", 1)])
        self.brain = createEmpty(range(4), range(4))
Example #8
0
    def __init__(self, pos):
        image = ("RSC/Ghost/GhostUp1.png")
        self.maxSpeed = 2
        speedx = random.randint(-self.maxSpeed, self.maxSpeed)
        speedy = random.randint(-self.maxSpeed, self.maxSpeed)
        speed = [speedx, speedy]
        Creature.__init__(self, image, speed, pos)
        self.upImages = [
            pygame.image.load("RSC/Ghost/GhostUp1.png"),
            pygame.image.load("RSC/Ghost/GhostUp2.png")
        ]
        self.downImages = [
            pygame.image.load("RSC/Ghost/GhostDown1.png"),
            pygame.image.load("RSC/Ghost/GhostDown2.png")
        ]
        self.leftImages = [
            pygame.image.load("RSC/Ghost/GhostLeft1.png"),
            pygame.image.load("RSC/Ghost/GhostLeft2.png")
        ]
        self.rightImages = [
            pygame.image.load("RSC/Ghost/GhostRight1.png"),
            pygame.image.load("RSC/Ghost/GhostRight2.png")
        ]

        if math.fabs(self.speedx) >= math.fabs(self.speedy):
            if self.speedx >= 0:
                self.facing = "right"
            else:
                self.facing = "left"
        else:
            if self.speedy >= 0:
                self.facing = "down"
            else:
                self.facing = "up"

        self.changed = False
        self.images = self.downImages
        self.frame = 0
        self.maxFrame = len(self.images) - 1
        self.waitCount = 0
        self.maxWait = 60 * .25
        self.image = self.images[self.frame]
        self.rect = self.image.get_rect(center=self.rect.center)
 def __init__(self, pos):
     image = ("RSC/Block/Pot1.png")
     Creature.__init__(self, "RSC/Block/Pot1.png", [0, 0], pos)
     self.speedx = 0
     self.speedy = 0
     self.upImages = [pygame.image.load("RSC/Block/Pot1.png")]
     self.upHurtImages = [
         pygame.image.load("RSC/Block/Pot2.png"),
         pygame.image.load("RSC/Block/Pot3.png")
     ]
     self.health = 2
     self.facing = "up"
     self.changed = False
     self.waitCount = 0
     self.maxWait = 60 * .25
     self.images = self.upImages
     self.frame = 0
     self.maxFrame = len(self.images) - 1
     self.image = self.images[self.frame]
     self.rect = self.image.get_rect(center=self.rect.center)
Example #10
0
    def __init__(self, name, thing_property, property_die, biuld_property):
        Creature.__init__(self, name, thing_property, property_die)
        self.biuld_property = biuld_property

        def creation(self):
            print('God is create world')
Example #11
0
    def __init__(self, xPos, yPos):
        self.gender = random.randint(0, 1)
        if (self.gender == 0):
            self.firstname = random.choice(maleFirstnames)
        else:
            self.firstname = random.choice(femaleFirstnames)
        self.surname = random.choice(adjectives) + random.choice(nouns)
        self.height = random.choice(heights)
        self.build = random.choice(builds)
        self.hairstyle = random.choice(hairstyles)
        self.haircolour = random.choice(haircolours)
        if (self.gender == 0):
            self.beardType = random.choice(beardTypes)
        else:
            self.beardType = None
        self.noseType = random.choice(noseTypes)
        self.eyeType = random.choice(eyeTypes)
        self.eyeColor = random.choice(eyeColors)
        self.chinType = random.choice(chinTypes)
        self.teethType = random.choice(teethTypes)
        self.skinColor = random.choice(skinColors)
        self.complexion = random.choice(complexions)

        self.baseStats = {
            "sociability":
            PersonStat(
                random.randint(0, 10) / 10,
                ["very shy", "shy", "quite sociable", "very outgoing"]),
            "workethic":
            PersonStat(
                random.randint(0, 10) / 10, [
                    "very lazy", "lothargic", "quite hardworking",
                    "very industrious"
                ]),
            "speed":
            PersonStat(
                random.randint(0, 10) / 10,
                ["sloth-like", "sluggish", "quick", "super speedy"]),
            "strength":
            PersonStat(random.randint(0, 10) / 10, ["weak", "strong"]),
            "trustworthiness":
            PersonStat(
                random.randint(0, 10) / 10, [
                    "very shady", "shady", "of average trustworthiness",
                    "trustworthy", "truly honourable"
                ]),
            "trustfulness":
            PersonStat(
                random.randint(0, 10) / 10, [
                    "untrusting to the point of paranoia",
                    "naturally suspicious", "trusting", "overtrusting"
                ])
        }

        self.needs = {
            "hunger":
            PersonNeed(0,
                       random.randint(0, 10) / 100, [
                           "completely full", "sated", "a bit peckish",
                           "ravenous", "starving"
                       ],
                       random.randint(0, 10) / 10),
            "thirst":
            PersonNeed(0,
                       random.randint(0, 10) / 100, [
                           "not thirsty", "not very thirsty",
                           "kind of thirsty", "parched", "seriously dehydrated"
                       ],
                       random.randint(0, 10) / 10),
            "sleepiness":
            PersonNeed(
                0,
                random.randint(0, 10) / 100,
                ["wide awake", "awake", "a bit tired", "tired", "knackered"],
                random.randint(0, 10) / 10)
        }

        pChar = '\u263A'
        pCol = 7

        self.target = None

        self.description = self.GenerateDescription()

        self.shortDesc = self.firstname + " " + self.surname

        Creature.__init__(self, xPos, yPos, pChar, pCol, self.description, 20,
                          self.shortDesc, False)

        self.exText = []
Example #12
0
 def __init__(self, name, level, health, attackpower, icepower):
     Creature.__init__(self, name, level, health, attackpower)
     self.icepower = icepower
Example #13
0
 def __init__(self, name, level, health, attackpower, firepower):
     Creature.__init__(self, name, level, health, attackpower)
     self.firepower = firepower
Example #14
0
 def __init__(self, name, level, attackpower, firepower, health=None):
     # super().__init__(name, level, health, attackpower)
     Creature.__init__(self, name, level, attackpower, health)
     self.firepower = firepower
Example #15
0
 def __init__(self, name, level, attackpower, icepower, health=None):
     Creature.__init__(self, name, level, attackpower, health)
     self.icepower = icepower
Example #16
0
 def __init__(self, name, thing_property, gender, property_die):
     Creature.__init__(self, name, thing_property, property_die)
     self.gender = gender
    def __init__(self, pos):
        Creature.__init__(self, "RSC/Demon/DemonDown1.png", [0, 0], pos)
        self.speedx = 0
        self.speedy = 2
        self.upImages = [
            pygame.image.load("RSC/Demon/DemonUp1.png"),
            pygame.image.load("RSC/Demon/DemonUp2.png")
        ]
        self.downImages = [
            pygame.image.load("RSC/Demon/DemonDown1.png"),
            pygame.image.load("RSC/Demon/DemonDown2.png")
        ]
        self.leftImages = [
            pygame.image.load("RSC/Demon/DemonLeft1.png"),
            pygame.image.load("RSC/Demon/DemonLeft2.png")
        ]
        self.rightImages = [
            pygame.image.load("RSC/Demon/DemonRight1.png"),
            pygame.image.load("RSC/Demon/DemonRight2.png")
        ]
        self.upHurtImages = [
            pygame.image.load("RSC/Demon/DemonUpHit1.png"),
            pygame.image.load("RSC/Demon/DemonUpHit2.png")
        ]
        self.downHurtImages = [
            pygame.image.load("RSC/Demon/DemonDownHit1.png"),
            pygame.image.load("RSC/Demon/DemonDownHit2.png")
        ]
        self.leftHurtImages = [
            pygame.image.load("RSC/Demon/DemonLeftHit1.png"),
            pygame.image.load("RSC/Demon/DemonLeftHit2.png")
        ]
        self.rightHurtImages = [
            pygame.image.load("RSC/Demon/DemonRightHit1.png"),
            pygame.image.load("RSC/Demon/DemonRightHit2.png")
        ]
        self.seen = False
        self.direction = "down"
        self.changed = False
        self.images = self.downImages
        self.frame = 0
        self.maxFrame = len(self.images) - 1
        self.waitCount = 0
        self.maxWait = 60 * .25
        self.image = self.images[self.frame]
        self.rect = self.image.get_rect(center=self.rect.center)
        self.maxSpeed = 2
        self.radius = (int(self.rect.height / 2.0 + self.rect.width / 2.0) /
                       2) - 1
        self.detectionRadius = 96
        self.shooting = False
        self.health = 2

        if math.fabs(self.speedx) >= math.fabs(self.speedy):
            if self.speedx >= 0:
                self.facing = "right"
            else:
                self.facing = "left"
        else:
            if self.speedy >= 0:
                self.facing = "down"
            else:
                self.facing = "up"
Example #18
0
 def __init__(self, x, y, team):
     
     Creature.__init__(self, x, y, PEASANT_SPEED, PEASANT_LIFE, PEASANT_REGENERATION, team)
     
     self.buildTime = 0
Example #19
0
 def __init__(self, thing_property, ability_to_die, biuld_property):
     Creature.__init__(self, 'God', thing_property, ability_to_die)
     self.biuld_property = biuld_property
Example #20
0
 def __init__(self, name):
     # 显示调用初始方法, 因为子类自定义了初始方法,反之,则不用
     Creature.__init__(self)
     self.name = name