Package com.l2client.animsystem

Examples of com.l2client.animsystem.Animation


*/
public class Retreat extends Action {
  @Override
  protected Animation evaluate(Mediator med){

    Animation ret = null;
    if(med.forceLockCheck(Channels.AllChannels,2)){
      ret = med.getAnimation();
      ret.setChannel(med.getChannel(Channels.AllChannels));
      ret.setLevel(2);
      ret.setBlendTime(0.1f);
      ret.setName("retreat");
      return ret;
    }
   
    return null;
  }
View Full Code Here


*/
public class Defend extends Action {
  @Override
  protected Animation evaluate(Mediator med){

    Animation ret = null;
    if(med.forceLockCheck(Channels.AllChannels,3)){
      ret = med.getAnimation();
      ret.setChannel(med.getChannel(Channels.AllChannels));
      ret.setLevel(3);
      ret.setBlendTime(0.2f);
      ret.setLooping(false);
      InputProvider i = med.getInput();
      int v = rand.nextInt(4);
      //diversity for horizon
      String dir = "mid";
      if(v<=0)
        dir="hi";
      else if(v>=3)
        dir="lo";
      //diversity in case Hurt is none for left right front back
      if(i.getInput(HurtVector.class).equals(HurtVector.None)){
        switch(rand.nextInt(4)){
        case 0:i.setInput(HurtVector.Left);break;
        case 1:i.setInput(HurtVector.Right);break;
        default:break;
        }
      }
     
     
      switch(i.getInput(HurtVector.class)){
      case None:
      case Front:
      case Back:{ret.setName("defend_"+dir+"_stab");break;}
      case Left:{ret.setName("defend_"+dir+"_slashlr");break;}
      case Right:{ret.setName("defend_"+dir+"_slashrl");break;}
      }
      log.info("Defend:->"+ret.getName());
      return ret;
    }
    return null;
  }
View Full Code Here

*
*/
public class Wounded extends Action {
  @Override
  protected Animation evaluate(Mediator med) {
    Animation ret = null;
    if (med.forceLockCheck(Channels.AllChannels, 4)) {
      ret = med.getAnimation();
      ret.setChannel(med.getChannel(Channels.AllChannels));
      ret.setLevel(4);
      ret.setBlendTime(0.05f);
      ret.setLooping(false);
      InputProvider i = med.getInput();
      switch (i.getInput(Hurt.class)) {
      case None:
        ret.setName("ready");
        break;
      case Light: {
        int j = rand.nextInt(10);
        String name;
        if (rand.nextInt(10) > 7) {
          name = "knockback_";
        } else {
          name = "knockback_move_";
        }

        switch (i.getInput(HurtVector.class)) {
        case None:
        case Front:
          switch (j) {
          case 0:
          case 1:
          case 2:
          case 3:
          case 4:
          case 5:
            ret.setName(name + "from_front");
            break;
          case 6:
          case 7:
            ret.setName(name + "from_left");
            break;
          case 8:
          case 9:
            ret.setName(name + "from_right");
            break;
          }
          break;
        case Back:
          switch (j) {
          case 0:
          case 1:
          case 2:
          case 3:
          case 4:
          case 5:
            ret.setName(name + "from_back");
            break;
          case 6:
          case 7:
            ret.setName(name + "from_left");
            break;
          case 8:
          case 9:
            ret.setName(name + "from_right");
            break;
          }
          break;
        case Left:
          switch (j) {
          case 0:
          case 1:
          case 2:
          case 3:
          case 4:
          case 5:
            ret.setName(name + "from_left");
            break;
          case 6:
          case 7:
            ret.setName(name + "from_front");
            break;
          case 8:
          case 9:
            ret.setName(name + "from_back");
            break;
          }
          break;
        case Right:
          switch (j) {
          case 0:
          case 1:
          case 2:
          case 3:
          case 4:
          case 5:
            ret.setName(name + "from_right");
            break;
          case 6:
          case 7:
            ret.setName(name + "from_front");
            break;
          case 8:
          case 9:
            ret.setName(name + "from_back");
            break;
          }
        }

        break;
      }
      case Severe: {
        ret.setLooping(false);
        ret.setKeep(1.0f);
        switch (i.getInput(HurtVector.class)) {
        case None:
        case Left:
        case Right:
          if (rand.nextInt(1) > 0)
            ret.setName("knockdown_backward_launch");
          else
            ret.setName("knockdown_forward_launch");
          break;
        case Front:
          ret.setName("knockdown_backward_launch");
          break;
        case Back:
          ret.setName("knockdown_forward_launch");
          break;

        }
        break;
      }
      case Deadly: {
        ret.setLooping(false);
        ret.setKeep(1.0f);
        switch (i.getInput(HurtVector.class)) {
        case None:
        case Front:
          ret.setName("die_backward");
          break;
        case Back:
          ret.setName("die_forward");
          break;
        case Left:
          ret.setName("die_to_back_left");
          break;
        case Right:
          ret.setName("die_to_back_right");
          break;
        }
        break;
      }
      }

    }
    log.info("Wounded:->" + ret.getName());
    return ret;
  }
View Full Code Here

*/
public class DefaultAttack extends Action {
  @Override
  protected Animation evaluate(Mediator med){

    Animation ret = null;
    if(med.forceLockCheck(Channels.AllChannels,3)){
      ret = med.getAnimation();
      ret.setChannel(med.getChannel(Channels.AllChannels));
      ret.setBlendTime(0.2f);
      ret.setLooping(false);
      ret.setLevel(3);
      InputProvider i = med.getInput();
      String ending = "_fail";
      if(AttackResult.Success.equals(i.getInput(AttackResult.class)))
          ending = "_success";
      if(Weapon.None.equals(i.getInput(Weapon.class)))
          ret.setName("at_hi_a_punch"+ending);
     
      switch(i.getInput(AttackVector.class)){

      case High_LeftRight:{ret.setName("at_hi_c_slashlr"+ending);break;}
      case High_RightLeft:{ret.setName("at_hi_c_slashrl"+ending);break;}
      case High_Front:{
          int n = rand.nextInt(1);
          if(n>0)
            ret.setName("at_hi_c_slashlr"+ending);
          else
            ret.setName("at_hi_c_slashrl"+ending);
         
          break;}
      case None://{ret.setName("");break;}//don't do this there is no anim "" this will blow
      case Mid_LeftRight:
      case Mid_RightLeft:
      case Mid_Front:
      case Low_LeftRight:
      case Low_RightLeft:
      case Low_Front:{ret.setName(getMidLowResult(i.getInput(AttackVector.class))+ending);break;}
      }
      log.info("DefaultAttack:->"+ret.getName());
      return ret;
    }
    return null;
  }
View Full Code Here

*
*/
public class Revive extends Action {
  @Override
  protected Animation evaluate(Mediator med) {
    Animation ret = null;
    if (med.forceLockCheck(Channels.AllChannels, 5)) {
      ret = med.getAnimation();
      ret.setChannel(med.getChannel(Channels.AllChannels));
      ret.setLevel(5);
      ret.setBlendTime(0.3f);
      ret.setLooping(false);
      ret.setKeep(0.5f);
      ret.setName("stand_a_idle");
    }
    return ret;
  }
View Full Code Here

*
*/
public class Die extends Action {
  @Override
  protected Animation evaluate(Mediator med) {
    Animation ret = null;

      if (med.forceLockCheck(Channels.AllChannels, 5)) {
        ret = med.getAnimation();
        ret.setChannel(med.getChannel(Channels.AllChannels));
        ret.setLevel(5);
        ret.setBlendTime(0.1f);
        ret.setLooping(false);
        ret.setKeep(432000f);//we want him to lay down reaaalllly long
        ret.setName(getDeathAnimation(med.getInput()));
        log.info("Die:->"+ret.getName());
        return ret;
      }
    return null;
  }
View Full Code Here

*
*/
public class Celebrate extends Action {
  @Override
  protected Animation evaluate(Mediator med) {
    Animation ret = null;
    if (!Direction.None.equals(med.getInput().getInput(Direction.class))) {
      if (med.forceLockCheck(Channels.AllChannels, 1)) {
        ret = med.getAnimation();
        ret.setLevel(1);
        ret.setChannel(med.getChannel(Channels.AllChannels));
        ret.setBlendTime(0.2f);
        ret.setLooping(false);
        ret.setName("celebrate");
        return ret;
      }
    }
    return null;
  }
View Full Code Here

*
*/
public class StopMove extends Action {
  @Override
  protected Animation evaluate(Mediator med) {
    Animation ret = null;
    log.info("evaluating StopMove");
    if (Speed.None.equals(med.getInput().getInput(Speed.class))) {
      if (med.forceLockCheck(Channels.AllChannels, 2)) {
        ret = med.getAnimation();
        ret.setChannel(med.getChannel(Channels.AllChannels));
        ret.setLevel(1);
        ret.setBlendTime(0f);
        ret.setName("stand_a_idle");
        log.info("StopMove OK");
        return ret;
      }else
        log.info("StopMove forceLock Level 2 FAILED");
    } else
View Full Code Here

  }

  private Animation movingAnimation(Mediator med, InputProvider in) {

    if (med.setLockCheck(Channels.AllChannels, 2)) {
      Animation ret = med.getAnimation();
      ret.setLevel(2);
      switch (in.getInput(Enemy.class)) {
      case None:
      case VeryFar: {
        if (Speed.Run.equals(in.getInput(Speed.class))) {
          ret.setName("run");
        } else {
          ret.setName("walk");
        }
        ret.setBlendTime(0.1f);
        break;
      }
      default: {
        if (Speed.Run.equals(in.getInput(Speed.class))) {
          if (Acting.Open.equals(in.getInput(Acting.class))) {
            switch (in.getInput(Enemy.class)) {
            case Close: {
              ret.setName(getShuffleResult(in));
              break;
            }
            case Near: {
              ret.setName("charge");
              break;
            }
            case Far:
            case VeryFar:
              ret.setName("combat_jog");
            }
          } else
            ret.setName("stealthy_walk");
        } else {
          if (Enemy.Close.equals(in.getInput(Enemy.class)))
            ret.setName(getShuffleResult(in));
          else
            ret.setName("advance");
        }
        ret.setBlendTime(0.5f);
        break;
      }
      }
      if (ret != null) {
        ret.setChannel(med.getChannel(Channels.AllChannels));
        return ret;
      }
    }
    return null;
  }
View Full Code Here

    }
    return null;
  }

  private Animation standingAnimation(Mediator med, InputProvider in) {
    Animation an = null;
    if (med.setLockCheck(Channels.AllChannels, 1)) {
      switch (in.getInput(Enemy.class)) {
      case None:
      case VeryFar: {
        an = standingAnimationOutCombat(med, in);
        break;
      }
      default: {
        an = standingAnimationInCombat(med, in);
        break;
      }
      }
      if (an != null) {
        an.setChannel(med.getChannel(Channels.AllChannels));
        an.setLevel(1);
        return an;
      }
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of com.l2client.animsystem.Animation

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.