Package horizons :: Package world :: Package units :: Module weapon :: Class StackableWeapon
[hide private]
[frames] | no frames]

Class StackableWeapon

source code

Weapon --+
         |
        StackableWeapon

Stackable Weapon class A generic Weapon that can have a number of weapons binded per instance It deals the number of weapons times weapon's default damage This is used for cannons, reducing the number of instances and bullets fired

Instance Methods [hide private]
 
__init__(self, session, id) source code
 
__init(self) source code
 
set_number_of_weapons(self, number)
Sets number of cannons as resource binded to a StackableWeapon object the number of cannons increases the damage dealt by one StackableWeapon instance
source code
 
increase_number_of_weapons(self, number)
Increases number of cannons as resource binded to a StackableWeapon object
source code
 
decrease_number_of_weapons(self, number)
Decreases number of cannons as resource binded to a StackableWeapon object
source code
 
get_damage_modifier(self) source code
    Inherited from Weapon
 
__str__(self) source code
 
check_target_in_range(self, distance)
Checks if the distance between the weapon and target is in weapon range
source code
 
fire(self, destination, position)
Fires the weapon at a certain destination
source code
 
get_maximum_range(self) source code
 
get_minimum_range(self) source code
 
get_ticks_until_ready(self)
Returns the number of ticks until the attack is ready If attack is ready return 0
source code
 
make_attack_ready(self) source code
Class Methods [hide private]
    Inherited from Weapon
 
load_attacks(cls, session, db)
Loads ongoing attacks from savegame database Creates scheduled calls for on_impact
source code
 
on_impact(cls, session, weapon_id, damage, position)
Classmethod that deals damage to units at position, depending on weapon_id Damage is done independent of the weapon instance, which may not exist at the time damage is done
source code
 
save_attacks(cls, db)
Saves ongoing attacks
source code
Class Variables [hide private]
    Inherited from Weapon
  log = logging.getLogger("world.combat")
Method Details [hide private]

__init__(self, session, id)
(Constructor)

source code 
Parameters:
  • session - game session
  • id - weapon id to be initialized
Overrides: Weapon.__init__
(inherited documentation)

set_number_of_weapons(self, number)

source code 

Sets number of cannons as resource binded to a StackableWeapon object the number of cannons increases the damage dealt by one StackableWeapon instance

Parameters:
  • number - number of cannons

increase_number_of_weapons(self, number)

source code 

Increases number of cannons as resource binded to a StackableWeapon object

Parameters:
  • number - number of cannons

decrease_number_of_weapons(self, number)

source code 

Decreases number of cannons as resource binded to a StackableWeapon object

Parameters:
  • number - number of cannons

get_damage_modifier(self)

source code 
Overrides: Weapon.get_damage_modifier