| |
- mob
class mob |
|
giant enemy class.
All the mob generation, IA and movement is implemented here.
#General attributes
lv=1 #Mob level
exp=0 #Experience given to the player
pres=1 #Prestige given to the player
name="" #Name
#Position variables
xpos=0
ypos=0
zpos=0
#Primary attributes
INT=0 #Intelligence
DEX=0 #Dexterity
PER=0 #Perception
WIL=0 #Willpower
STR=0 #Strenght
CON=0 #Constitution
CHA=0 #Charisma
#Secondary attributes
HP=0 #Total life
MP=0 #Total mana
END=0 #Endurance
SPD=0 #Speed
atk=4 #Attack power
defn=0 #Defense power
#Status variables
lock=0 #Locked onto a target for attack
hit=0 #Flags when the mob is hit (Does half damage) |
|
Methods defined here:
- __init__(self, dungeon, level)
- Mob generator
Receives a dungeon object and places the mob in a random spot that is not filled with rock.
Needs the dungeon and the level. If the level is equal or less than 0 a random level is selected.
- attack(self, player, dung)
- Attacks the player object passed to the function
- move(self, dungeon, direction, distance)
- Move function. Needs a dungeon object.
Accepts direction and distance
1 north
2 west
3 south
4 east
If the mob is locked the function does nothing
- randmove(self, dungeon, dist)
- Moves the mob in a random direction a given number of tiles
- search(self, dungeon, player)
- If the player is within the perception range of the mob, it chases.
If not, it moves randomly within the dungeon.
- trandmove(self, dungeon)
- Moves 1 tile in a random direction
| |