Package org.timerescue.action

Examples of org.timerescue.action.DefaultAttackAction$Constants$Default


   * Return an appropriate attack action to be performed
   * @return
   */
  private DefaultAttackAction getAttack() {
    // TODO Check on other skills and see how to attack
    DefaultAttackAction attack =
        (DefaultAttackAction) ActionFactory.getInstance(
            DefaultAttackAction.class);
    return attack;

  }
View Full Code Here


  /**
   * Test method for {@link org.timerescue.utils.Introspection#getSerializableFromClass(java.lang.String)}.
   */
  @Test
  public void testGetSerializableFromClass() {
    DefaultAttackAction action = new DefaultAttackAction();
    String clasname = action.getClass().getName();
    Serializable ser = null;
    try {
      ser = Introspection.getSerializableFromClass(action.getClass().getName());
    } catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      fail("Error ClassNotFound");
    } catch (InstantiationException e) {
View Full Code Here

        Constants.Property.AGGRESSIVENESS);
    //TODO pass this to behaviors
    //Getting environment information
    //I am already attacking? or am i the target?
    if (state_holder.isStateActive(DefaultAttackAction.class)){     
      DefaultAttackAction attack = (DefaultAttackAction) state_holder.getState(
          DefaultAttackAction.class);
      Agent target = attack.getTarget();
      //Counter attack if it is the target
      decision = attack(target);
      //If the target couldn't be reached remove states
      if(decision.equals(null)){
        attack.removeStates();
      }
    }else{
      //Is it aggressive?
      if (Boolean.parseBoolean(aggressiveness)){     
        decision = attack();
View Full Code Here

   * Attack : aggressive behavior towards any low life target
   * @return
   */
  private Action attack() {
    // TODO Check on other skills and see how to attack
    DefaultAttackAction attack = getAttack();
    //Looking for other agents
    Element element;
    Agent target = null, temp = null;
    int target_life, temp_life;
    for (int i = 0; i < surroundings.length; i++) {
View Full Code Here

   * @param target
   * @return the attack action
   */
  private Action attack(Agent target) {   
    if(target !=null){
      DefaultAttackAction attack = getAttack();
      //Add target
      attack.setTarget(target);
      //Set attacker
      attack.setAttacker(this);
      return attack;
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.timerescue.action.DefaultAttackAction$Constants$Default

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.