Bomb (version 1.2d, mer. 13/02/2013 at 04h:00m:20s )
index
Bomb.py
Bomb.py.html

This module implement a simple bomb system for Bomberman game.
 
There is two classes for Bombs :
 * BombNoOwner  -- one without any information about the player which own it,
 * Bomb         -- an other with an additionnal attribute *owner*.

 
Modules
       
ANSIColors
KeyBinding
os
subprocess

 
Classes
       
BombNoOwner
Bomb

 
class Bomb(BombNoOwner)
    A Class to define a Bomberman bomb.
It is just a BombNoOwner with an extra *owner* attribute.
 
Attributes:
 * owner        -- the indicator of the player which droped the bomb.
 * force        -- the dimension of explosion.
 * timer        -- the timer of the bomb.
 * power        -- the power of the bomb (number of inguries infliged by the bomb).
 
This class can be used both by the client and the server.
 
  Methods defined here:
__init__(self, owner, force=4, timer=4, power=1, verb=True)
Simple constructor of a bomb.
The [owner] have to be given, the others paramaters can be omitted.
[owner] is used to be a Player.Player instance, but formally coulb be anything.
__str__(self)
Simple conversion to string.

Methods inherited from BombNoOwner:
__repr__(self)
Toplevel representation of [self].
tic(self, toc=1)
Just decrease the timer of the bomb, [toc] is the time spent during ticking.
self.timer<=0 is returned.
Allow the following shortcut :
 
Example:
 >>> if board[i,j].bomb.tic:
 >>>  print 'My bomb at place (%i,%i) is exploding !!' % (i,j)
 >>>  game.make_explosion(board[i,j].bomb) # a toy example.
 >>> else:
 >>>  print 'Hourra, the bomb at place (%i,%i) is not exploding !!' % (i,j)

 
class BombNoOwner
    A Class to define a Bomberman bomb.
This bomb have no information about his owner, because it's aimed to be store in the Player.Player class.
 
Attributes:
 * force        -- the dimension of explosion.
 * timer        -- the timer of the bomb.
 * power        -- the power of the bomb (number of inguries infliged by the bomb).
 
This class can be used both by the client and the server.
 
  Methods defined here:
__init__(self, force=4, timer=4, power=1, verb=False)
Simple constructor of a bomb.
__repr__(self)
Toplevel representation of [self].
__str__(self)
tic(self, toc=1)
Just decrease the timer of the bomb, [toc] is the time spent during ticking.
self.timer<=0 is returned.
Allow the following shortcut :
 
Example:
 >>> if board[i,j].bomb.tic:
 >>>  print 'My bomb at place (%i,%i) is exploding !!' % (i,j)
 >>>  game.make_explosion(board[i,j].bomb) # a toy example.
 >>> else:
 >>>  print 'Hourra, the bomb at place (%i,%i) is not exploding !!' % (i,j)

 
Functions
       
add_owner(bomb, owner)
add_owner(bomb, owner) -> Bomb.Bomb instance
Transform a Bomb.BombNoOwner instance to a Bomb.Bomb instance,
 by adding to it the *owner*.
getlogin(...)
getlogin() -> string
 
Return the actual login name.
getpid(...)
getpid() -> pid
 
Return the current process id

 
Data
        BREAK_ON_WALL = True
CLOCK_FREQUENCY = 20.0
INFORM_CLIENTS = False
LX_CST = 11
LY_CST = 11
NB_BOMB_MAX_ALLOW = 1
NB_PLAYER = 3
PLAYER_CHECK_ACTION = False
PORT_INIT = 12882
PRINT_ALL_MESSAGE = 1
PRINT_ALL_PARSEIN = False
PRINT_ALL_PARSEOUT = False
PRINT_CLEAR_EACH_TIME = False
PROBA_BONUS = 0.05
PROBA_UMUR = 0.08
SERVEUR_INIT = '0.0.0.0'
SIGNAL_BOMB_HURT = 5
SIGNAL_I_NEGATIVE = 2
SIGNAL_J_NEGATIVE = 3
SIGNAL_PLAYER_HURT = 3
SIGNAL_TYPE_WRONG = 1
SIGNAL_WALL_BREAKE = 2
SIGNAL_WALL_NOT_BREAKE = 4
TIME_EXPLOSION = 3.0
TIME_FADEOUT = 8
TYPE_MAP = 0
USE_BONUS_SYSTEM = False
USE_DATABASE = False
USE_DIRECTION_FOR_PLAYER = False
USE_FULLSCREEN = False
USE_MUSIC = False
USE_NOTIFY = False
USE_PICKLING = False
USE_SOUND_EFFECT = False
USE_WINDOW = True
__author__ = 'Lilian BESSON (mailto:lilian.besson[AT]normale.fr)'
__date__ = 'mer. 13/02/2013 at 04h:00m:20s '
__version__ = '1.2d'
color_Init = 'white'
colors_CST = ['green', 'red', 'blue', 'black', 'cyan', 'magenta', 'yellow', 'white']
death_message_Init = 'You died :('
filename_database = 'database_clients.db'
filename_pickling = 'savegame.ess'
force_default = 4
i = 2
info_server_Init = ('0.0.0.0', 12882)
keyBindingList = [North/Up:'['K_z']'; South/Down:'['K_s']'; East/L.../Right:'['K_d']'; Bomb:'['K_x']'; Help:'['K_h']'., North/Up:'['K_z']'; South/Down:'['K_s']'; East/L.../Right:'['K_d']'; Bomb:'['K_x']'; Help:'['K_h']'., North/Up:'['K_z']'; South/Down:'['K_s']'; East/L.../Right:'['K_d']'; Bomb:'['K_x']'; Help:'['K_h']'.]
lx_Max = 19
ly_Max = 19
nb_bomb_Init = 0
nbmax_Max = 8
owner_default = None
power_default = 1
pseudo_Init = 'YouCanSetYourPseudoWithCommand--pseudo'
pseudos_CST = ['Aur\xc3\xa9lie', 'Bobby', 'Celia', 'Dalia', '\xc3\x89milie', 'Fhu', 'Gnome', 'Harry']
pseudos_IA = ['Anne', 'Bob', 'Clark', 'Dan', 'Emma', 'Fabian', 'George', 'Hermionne', 'Ian', 'John', 'Karol', 'Laura', 'Manu', 'Natalie', 'Oph\xc3\xa9lie', 'Patrice', 'Quention', 'Raoul', 'Susane', 'Tiphaine', ...]
pv_Init = 3
timer_default = 4
toc_default = 1
verb = False
verb2 = False
x_Init = 0
y_Init = 0

 
Author
        Lilian BESSON (mailto:lilian.besson[AT]normale.fr)