cz.cuni.amis.pogamut.defcon.example
Class MixedFleetAI

Package class diagram package MixedFleetAI
java.lang.Object
  extended by cz.cuni.amis.pogamut.defcon.ai.AbstractAI
      extended by cz.cuni.amis.pogamut.defcon.example.MixedFleetAI
All Implemented Interfaces:
IFleetAI, IUnitAI

public class MixedFleetAI
extends AbstractAI
implements IFleetAI

MixedFleetAI

Author:
Radek 'Black_Hand' Pibil

Nested Class Summary
protected static class MixedFleetAI.State
           
 
Field Summary
protected  float arrivalTime
           
protected  boolean canLaunch
           
protected  MixedFleetAI.State currentState
           
protected  DefConLocation currentTargetLocation
           
protected  List<Integer> enemyCityIds
           
protected  Fleet fleet
           
protected  float lastTargetSelect
           
protected  cz.cuni.amis.pogamut.base.communication.worldview.event.IWorldEventListener<DefConChanged> level3DefconListener
           
protected  DefConLocation optimizedTargetLocation
           
protected  DefConLocation originalLocation
           
protected static double TARGET_SELECTION_LIMIT
           
protected  Fleet targetFleet
           
protected  DefConLocation targetLocation
           
 
Fields inherited from class cz.cuni.amis.pogamut.defcon.ai.AbstractAI
logic, unitId, worldObjectId
 
Constructor Summary
MixedFleetAI(DefConLocation target, Fleet fleet, ExampleBotLogicController logic)
           
 
Method Summary
protected
<T> boolean
arrayContains(T[] array, T element)
           
protected
<T> int
arrayIndex(T[] array, T element)
           
protected  String arrayToString(int[] array)
           
protected  void caculateBestMovementTarget()
           
 void dispose()
           
protected  int getClosestEnemyCityOwner(DefConLocation closestTo)
           
 Fleet getClosestEnemyFleet()
          Returns the closest visible enemy fleet.
 Fleet getClosestEnemyFleetWithUnit(UnitType type)
          Returns the closest visible enemy fleet with given unit type.
 Fleet getClosestEnemyFleetWithUnits(UnitType[] types)
          Returns the closest visible enemy fleet with given unit type.
 Fleet getFleet()
           
 int[] getFleetMembers()
           
 DefConLocation getLocation()
           
 ExampleBotLogicController getLogic()
           
protected  boolean hasSpareLaunchableNukes()
           
protected  boolean hasSpareNukes()
           
protected  boolean inNukeRange(DefConLocation unit, DefConLocation target, UnitType type)
           
protected  boolean inNukeRange(int unitId, int cityId, UnitType type)
           
protected  boolean inNukeState(int unitId)
           
protected  void launchNuke(int unitId, int targetId)
           
protected  void moveFleet(DefConLocation target)
           
protected  boolean nukeCapable(int unitId)
           
protected  void optimizeOriginalLocation()
           
protected  void refreshClosestEnemyFleet()
           
protected  void runGotoAttackPosition()
           
protected  void runHunt()
           
protected  void runLaunchNukes()
           
protected  void setAttackTarget(int targetId)
           
protected  void setMoveToTarget()
           
 void setTargetLocation(DefConLocation target)
           
protected  boolean toNukeState(int unitId)
           
 void update()
           
 
Methods inherited from class cz.cuni.amis.pogamut.defcon.ai.AbstractAI
act, getId, receiveMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cz.cuni.amis.pogamut.defcon.ai.IUnitAI
getId, receiveMessage
 

Field Detail

fleet

protected final Fleet fleet

targetLocation

protected DefConLocation targetLocation

optimizedTargetLocation

protected DefConLocation optimizedTargetLocation

currentTargetLocation

protected DefConLocation currentTargetLocation

originalLocation

protected DefConLocation originalLocation

enemyCityIds

protected final List<Integer> enemyCityIds

canLaunch

protected boolean canLaunch

arrivalTime

protected float arrivalTime

currentState

protected MixedFleetAI.State currentState

level3DefconListener

protected final cz.cuni.amis.pogamut.base.communication.worldview.event.IWorldEventListener<DefConChanged> level3DefconListener

TARGET_SELECTION_LIMIT

protected static final double TARGET_SELECTION_LIMIT
See Also:
Constant Field Values

targetFleet

protected Fleet targetFleet

lastTargetSelect

protected float lastTargetSelect
Constructor Detail

MixedFleetAI

public MixedFleetAI(DefConLocation target,
                    Fleet fleet,
                    ExampleBotLogicController logic)
Method Detail

optimizeOriginalLocation

protected void optimizeOriginalLocation()

setMoveToTarget

protected void setMoveToTarget()

moveFleet

protected void moveFleet(DefConLocation target)

update

public void update()
Specified by:
update in interface IUnitAI

runGotoAttackPosition

protected void runGotoAttackPosition()

runLaunchNukes

protected void runLaunchNukes()

runHunt

protected void runHunt()

setAttackTarget

protected void setAttackTarget(int targetId)

refreshClosestEnemyFleet

protected void refreshClosestEnemyFleet()

caculateBestMovementTarget

protected void caculateBestMovementTarget()

getClosestEnemyCityOwner

protected int getClosestEnemyCityOwner(DefConLocation closestTo)

arrayToString

protected String arrayToString(int[] array)

inNukeRange

protected boolean inNukeRange(int unitId,
                              int cityId,
                              UnitType type)

inNukeRange

protected boolean inNukeRange(DefConLocation unit,
                              DefConLocation target,
                              UnitType type)

launchNuke

protected void launchNuke(int unitId,
                          int targetId)

nukeCapable

protected boolean nukeCapable(int unitId)

inNukeState

protected boolean inNukeState(int unitId)

toNukeState

protected boolean toNukeState(int unitId)

hasSpareNukes

protected boolean hasSpareNukes()

hasSpareLaunchableNukes

protected boolean hasSpareLaunchableNukes()

getFleet

public final Fleet getFleet()

getLogic

public final ExampleBotLogicController getLogic()

setTargetLocation

public void setTargetLocation(DefConLocation target)
Specified by:
setTargetLocation in interface IFleetAI

getClosestEnemyFleet

public Fleet getClosestEnemyFleet()
Returns the closest visible enemy fleet.

Returns:
closest visible enemy fleet

getClosestEnemyFleetWithUnit

public Fleet getClosestEnemyFleetWithUnit(UnitType type)
Returns the closest visible enemy fleet with given unit type.

Parameters:
type - unitetype the enemy fleet has to contain
Returns:
closest visible enemy fleet with given unitetype

getClosestEnemyFleetWithUnits

public Fleet getClosestEnemyFleetWithUnits(UnitType[] types)
Returns the closest visible enemy fleet with given unit type.

Parameters:
type - unitetype the enemy fleet has to contain
Returns:
closest visible enemy fleet with given unitetype

dispose

public void dispose()
Specified by:
dispose in interface IUnitAI
Overrides:
dispose in class AbstractAI

arrayContains

protected <T> boolean arrayContains(T[] array,
                                    T element)

arrayIndex

protected <T> int arrayIndex(T[] array,
                             T element)

getFleetMembers

public int[] getFleetMembers()
Specified by:
getFleetMembers in interface IFleetAI

getLocation

public DefConLocation getLocation()
Specified by:
getLocation in interface IUnitAI


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.