示例#1
0
文件: action.py 项目: nrook/Spirit
    def do(self):
        level_ = self.source.currentLevel

        explosion_radius = coordinates.radius(1, self.source.coords, level_.dimensions)

        for coords in explosion_radius:
            level_.addSolidEffect(coords, self.EXPLOSION_GLYPH)

        kb.question(level_.messages, "%s explodes (%d)! --MORE--" % (self.source.getName(), self.damage))

        for explosion_coords in explosion_radius:
            if explosion_coords in level_.dudeLayer:
                target = level_.dudeLayer[explosion_coords]
                if target is not self.source:
                    target.cur_HP -= self.damage
                    target.currentLevel.removeSolidEffect(target.coords, self.EXPLOSION_GLYPH)
                    target.currentLevel.addSolidEffect(target.coords, self.EXPLOSION_GLYPH)
                    target.checkDeath()

        for coords in explosion_radius:
            level_.removeSolidEffect(coords, self.EXPLOSION_GLYPH)

        self.source.die()

        return self.source.speed
示例#2
0
文件: action.py 项目: nrook/Spirit
    def do(self):
        for explosion_coords in coordinates.radius(1, self.coords, self.level_.dimensions):
            if explosion_coords in self.level_.dudeLayer:
                target = self.level_.dudeLayer[explosion_coords]
                target.cur_HP -= self.damage
                self.level_.messages.append("%s is hurt by the explosion! (%d)" %
                    (target.getName(), self.damage))
                target.checkDeath()

        return 0
示例#3
0
    def showExplosion(self):
        """
        Cause the explosion effect to appear onscreen.
        """

        coords_in_explosion = coordinates.radius(1, self.coords, self.currentLevel.dimensions)
        for i in coords_in_explosion:
            self.currentLevel.addSolidEffect(i, self.EXPLOSION_GLYPH)
        kb.pause(self.currentLevel.messages)
        for i in coords_in_explosion:
            self.currentLevel.removeSolidEffect(i)