Package pajammin :: Package entity :: Package agent :: Module agent :: Class MeleeAttack
[show private | hide private]
[frames | no frames]

Type MeleeAttack

object --+    
         |    
AttackType --+
             |
            MeleeAttack


An attack type that affects agents in its 'area of effect', a rectangular area that is a fixed distance from the attacker.
Method Summary
  __init__(self, damage_type, damage, size, offset, multi_target, mark, animation, delay, cooldown, mana_cost)
  attack_range(self, attacker)
  fire(self, attacker, target)
Perform the actual attack action.
  hit(self, agent)
Apply this attack's effect to the given agent.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
Return hash(x)...
  __new__(T, S, ...)
Return a new object with type S, a subtype of T...
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
Return repr(x)...
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
Return str(x)...

Instance Variable Summary
  damage: The amount of damage that is inflicted by this attack.
  damage_type: The type of damage inflicted by this attack, such as PHYSICAL or FIRE.
  marker: A sprite category whose default animation should be displayed to show that the attack was successful.
  multi_target: If false (the default), then the attack will only affect one target in the the attack range; if true, then the attack will affect all targets in the attack range.
    Area of Effect
  size: A tuple (i,j), describing the size of the area in which targets will be affected by this attack.
  offset: A tuple (i,j), describing the position of the area in which targets will be affected by this attack.

Method Details

__init__(self, damage_type, damage, size=(15, 30), offset=(0, 0), multi_target=False, mark=None, animation=None, delay=0, cooldown=0, mana_cost=0)
(Constructor)

Overrides:
pajammin.entity.agent.agent.AttackType.__init__

attack_range(self, attacker)

fire(self, attacker, target=None)

Perform the actual attack action. This method does not perform any animations or start the agent's cooldown timer.
Parameters:
target - If specified, then this attack will only affect the given target; otherwise, it will affect any agent in the area of effect that is not on the same team.
Overrides:
pajammin.entity.agent.agent.AttackType.fire

hit(self, agent)

Apply this attack's effect to the given agent. By default, this just hurts the agent with this attack's damage; but subclasses can override this method to perform additional actions.

Instance Variable Details

size

A tuple (i,j), describing the size of the area in which targets will be affected by this attack. The i coordinate corresponds to distance in the direction that the agent is facing; and the j coordinates correspond to distance perpendicular to the direction that the agent is facing.

offset

A tuple (i,j), describing the position of the area in which targets will be affected by this attack. This offset describes the relationship between the middle of the agent and the nearer mid-side of the attack range. The i coordinate corresponds to distance in the direction that the agent is facing; and the j coordinates correspond to distance perpendicular to the direction that the agent is facing.

damage

The amount of damage that is inflicted by this attack. This can either be a single number, or a tuple (mindamage, maxdamage), in which case the actual damage for each attack will be randomly selected from that range.

damage_type

The type of damage inflicted by this attack, such as PHYSICAL or FIRE. If the attack has multiple damage types, then simply and the flags for each damage type together.

marker

A sprite category whose default animation should be displayed to show that the attack was successful.

multi_target

If false (the default), then the attack will only affect one target in the the attack range; if true, then the attack will affect all targets in the attack range.