Interface AttackStrategy
- All Known Implementing Classes:
AttackWeakest
,Coward
,StupidCoward
public interface AttackStrategy
a strategy for choosing an attack target and a mean of attack.
- Author:
- durkham
-
Method Summary
Modifier and TypeMethodDescriptionvoid
attacks the target.boolean
canAttackNow(Creature creature)
Can the specified creature do an attack now?boolean
canAttackNow(Creature attacker, RPEntity target)
Can the specified creature do an attack against a specified target?void
findNewTarget(Creature creature)
find a new target.void
getBetterAttackPosition(Creature creature)
Find a better position to do the attack, for example melees should walk closelyto their target but archers should stay away.int
getRange()
Get the maximum range of the attacking creature.boolean
hasValidTarget(Creature creature)
Does the creature have a valid target at the moment?
-
Method Details
-
canAttackNow
Can the specified creature do an attack now?- Parameters:
creature
- creature doing the attack- Returns:
- true, if it can attack, false otherwise
-
canAttackNow
Can the specified creature do an attack against a specified target?- Parameters:
attacker
- creature doing the attacktarget
- potential target- Returns:
- true, if it can attack, false otherwise
-
attack
attacks the target.- Parameters:
creature
- creature doing the attack
-
getRange
int getRange()Get the maximum range of the attacking creature.- Returns:
- maximum range
-
getBetterAttackPosition
Find a better position to do the attack, for example melees should walk closelyto their target but archers should stay away.- Parameters:
creature
- creature doing the attack
-
hasValidTarget
Does the creature have a valid target at the moment?- Parameters:
creature
- Creature which is attacking- Returns:
- true, if it has a valid target; false otherwise
-
findNewTarget
find a new target.- Parameters:
creature
- creature doing the attack
-