Package parpg :: Module charactercreationcontroller :: Class CharacterCreationController
[hide private]
[frames] | no frames]

Class CharacterCreationController

source code

                                       object --+        
                                                |        
        common.listeners.key_listener.KeyListener --+    
                                                    |    
                                       object --+   |    
                                                |   |    
    common.listeners.mouse_listener.MouseListener --+    
                                                    |    
                                       object --+   |    
                                                |   |    
common.listeners.command_listener.CommandListener --+    
                                                    |    
                        controllerbase.ControllerBase --+
                                                        |
                                                       CharacterCreationController

Controller defining the behaviour of the character creation screen.

Instance Methods [hide private]
 
__init__(self, engine, view, model, application)
Construct a new CharacterCreationController instance.
source code
 
startNewGame(self)
Create the new character and start a new game.
source code
 
cancelNewGame(self)
Exit the character creation view and return the to main menu.
source code
 
onStop(self)
Called when the controller is removed from the list.
source code
 
name(self)
Returns the name of the character.
source code
 
age(self)
Returns the age of the character.
source code
 
gender(self)
Returns the gender of the character.
source code
 
origin(self)
Returns the origin of the character.
source code
 
picture(self)
Returns the ID of the current picture of the character.
source code
 
getStatPoints(self)
Returns the remaining statistic points that can be distributed
source code
 
increaseStatistic(self, statistic)
Increases the given statistic by one.
source code
 
getStatisticIncreaseCost(self, statistic)
Calculate and return the cost to increase the statistic
source code
 
canIncreaseStatistic(self, statistic)
Checks whether the given statistic can be increased or not.
source code
 
decreaseStatistic(self, statistic)
Decreases the given statistic by one.
source code
 
getStatisticDecreaseGain(self, statistic)
Calculate and return the gain of decreasing the statistic
source code
 
canDecreaseStatistic(self, statistic)
Checks whether the given statistic can be decreased or not.
source code
 
getStatisticValue(self, statistic)
Returns the value of the given statistic.
source code
 
areAllStatisticsValid(self)
Checks if all statistics are inside the minimum/maximum values @return True if all statistics are valid False if not
source code
 
setName(self, name)
Sets the name of the character to the given value.
source code
 
isNameValid(self, name)
Checks whether the name is valid.
source code
 
changeOrigin(self, origin)
Changes the origin of the character to the given value.
source code
 
isOriginValid(self, origin)
Checks whether the origin is valid.
source code
 
changeGender(self, gender)
Changes the gender of the character to the given value.
source code
 
isGenderValid(self, gender)
Checks whether the gender is valid.
source code
 
changeAge(self, age)
Sets the age of the character to the given value.
source code
 
isAgeValid(self, age)
Checks whether the age is valid.
source code
 
setPicture(self, picture)
Set picture of the character.
source code
 
isPictureValid(self, picture)
Checks whether the picture is valid.
source code
 
addTrait(self, trait)
Adds a trait to the character.
source code
 
canAddAnotherTrait(self)
Checks whether another trait can be added.
source code
 
removeTrait(self, trait)
Remove trait from character.
source code
 
hasTrait(self, trait)
Checks whether the character has the trait.
source code
 
isTraitValid(self, trait)
Checks whether the trait is valid.
source code
 
areCurrentTraitsValid(self)
Checks whether the characters traits are valid.
source code
 
isCharacterValid(self)
Checks whether the character as a whole is valid.
source code

Inherited from controllerbase.ControllerBase: pause, pump, resetMouseCursor, setMouseCursor

Inherited from common.listeners.key_listener.KeyListener: attach, detach, keyPressed, keyReleased

Inherited from common.listeners.mouse_listener.MouseListener: mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMovedDown, mouseWheelMovedUp

Inherited from common.listeners.command_listener.CommandListener: onCommand

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  MAX_TRAITS = 3
  MIN_AGE = 16
  MAX_AGE = 40
  ORIGINS = {"None": None,}
  GENDERS = ["Male", "Female",]
  PICTURES = {"Male": ["None",], "Female": ["None",],}
  TRAITS = {}
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, engine, view, model, application)
(Constructor)

source code 

Construct a new CharacterCreationController instance.

Parameters:
  • engine (fife.Engine) - Rendering engine used to display the associated view.
  • view (ViewBase) - View used to display the character creation screen.
  • model (GameModel) - Model of the game state.
  • application (fife.extensions.basicapplication.ApplicationBase) - Application used to glue the various MVC components together.
Overrides: object.__init__

startNewGame(self)

source code 

Create the new character and start a new game.

Returns:
None

cancelNewGame(self)

source code 

Exit the character creation view and return the to main menu.

Returns:
None

onStop(self)

source code 

Called when the controller is removed from the list.

Returns:
None
Overrides: controllerbase.ControllerBase.onStop

name(self)

source code 

Returns the name of the character.

Returns:
Name of the character
Decorators:
  • @property

age(self)

source code 

Returns the age of the character.

Returns:
Age of the character
Decorators:
  • @property

gender(self)

source code 

Returns the gender of the character.

Returns:
Gender of the character
Decorators:
  • @property

origin(self)

source code 

Returns the origin of the character.

Returns:
Origin of the character
Decorators:
  • @property

picture(self)

source code 

Returns the ID of the current picture of the character.

Decorators:
  • @property

increaseStatistic(self, statistic)

source code 

Increases the given statistic by one.

Parameters:
  • statistic (string) - Name of the statistic to increase

getStatisticIncreaseCost(self, statistic)

source code 

Calculate and return the cost to increase the statistic

Parameters:
  • statistic (string @return cost to increase the statistic) - Name of the statistic to increase

canIncreaseStatistic(self, statistic)

source code 

Checks whether the given statistic can be increased or not.

Parameters:
  • statistic (string) - Name of the statistic to check
Returns:
True if the statistic can be increased, False if not.

decreaseStatistic(self, statistic)

source code 

Decreases the given statistic by one.

Parameters:
  • statistic (string) - Name of the statistic to decrease

getStatisticDecreaseGain(self, statistic)

source code 

Calculate and return the gain of decreasing the statistic

Parameters:
  • statistic (string @return cost to decrease the statistic) - Name of the statistic to decrease

canDecreaseStatistic(self, statistic)

source code 

Checks whether the given statistic can be decreased or not.

Parameters:
  • statistic (string) - Name of the statistic to check
Returns:
True if the statistic can be decreased, False if not.

getStatisticValue(self, statistic)

source code 

Returns the value of the given statistic.

Parameters:
  • statistic (string) - Name of the primary or secondary statistic
Returns:
Value of the given statistic

setName(self, name)

source code 

Sets the name of the character to the given value.

Parameters:
  • name (string) - New name

isNameValid(self, name)

source code 

Checks whether the name is valid.

Parameters:
  • name (string) - Name to check
Returns:
True if the name is valid, False if not

changeOrigin(self, origin)

source code 

Changes the origin of the character to the given value.

Parameters:
  • origin (string) - New origin

isOriginValid(self, origin)

source code 

Checks whether the origin is valid.

Parameters:
  • origin (string) - Origin to check
Returns:
True if the origin is valid, False if not

changeGender(self, gender)

source code 

Changes the gender of the character to the given value.

Parameters:
  • gender - New gender
  • gender - string

isGenderValid(self, gender)

source code 

Checks whether the gender is valid.

Parameters:
  • gender (string?) - Gender to check
Returns:
True if the origin is valid, False if not

changeAge(self, age)

source code 

Sets the age of the character to the given value.

Parameters:
  • age (integer) - New age

isAgeValid(self, age)

source code 

Checks whether the age is valid.

Parameters:
  • age (integer) - Age to check
Returns:
True if the origin is valid, False if not

setPicture(self, picture)

source code 

Set picture of the character.

Parameters:
  • picture (string) - ID of the new picture

isPictureValid(self, picture)

source code 

Checks whether the picture is valid.

Parameters:
  • picture (string) - ID of the picture to check
Returns:
True if the picture is valid, False if not

addTrait(self, trait)

source code 

Adds a trait to the character.

Parameters:
  • trait (string) - ID of the trait to add

canAddAnotherTrait(self)

source code 

Checks whether another trait can be added.

Returns:
True if another trait can be added, False if not

removeTrait(self, trait)

source code 

Remove trait from character.

Parameters:
  • trait (string) - ID of the trait to remove

hasTrait(self, trait)

source code 

Checks whether the character has the trait.

Parameters:
  • trait (string) - ID of the trait to check
Returns:
True if the character has the trait, False if not

isTraitValid(self, trait)

source code 

Checks whether the trait is valid.

Parameters:
  • trait (string) - ID of the trait to check
Returns:
True if the trait is valid, False if not

areCurrentTraitsValid(self)

source code 

Checks whether the characters traits are valid.

Returns:
True if the traits are valid, False if not

isCharacterValid(self)

source code 

Checks whether the character as a whole is valid.

Returns:
True if the character is valid, False if not