示例#1
0
  /** The player will perform a simple MeleeAttack. */
  public void simpleAttack() {
    if (state == DynamicObjectState.Attacking) return;

    state = DynamicObjectState.Attacking;

    if (!isInNetwork) {
      curAnim = simpleAttack.getAnimation(heading);
      manager.registerAttack(simpleAttack);
      simpleAttack.activate();
    } else {
      NetworkManager.sendAttackMessage(this);
    }
  }
 public void calculateStats() { // calculates stats based on equipped items
   if (equipment.itemAt(0, 0) != null) atk.damage = equipment.itemAt(0, 0).value1;
   if (equipment.itemAt(0, 1) != null)
     atkSpd = ((double) equipment.itemAt(0, 1).value1 / 100.0 + 1) * 0.8;
   if (equipment.itemAt(0, 2) != null) {
     armor = equipment.itemAt(0, 2).value1;
     maxHealth = 100 + equipment.itemAt(0, 2).value2;
   }
   if (equipment.itemAt(0, 3) != null) {
     armor += equipment.itemAt(0, 3).value1;
     maxMana = 100 + equipment.itemAt(0, 3).value2;
   }
   if (equipment.itemAt(0, 4) != null) {
     maxHealth += equipment.itemAt(0, 4).value1;
     atk.damage += equipment.itemAt(0, 4).value2;
   }
 }
示例#3
0
 /**
  * The player received an attackMessage in a network game. This method sets the AttackingState and
  * initializes the attack.
  */
 public void receivedAttackMsg() {
   state = DynamicObjectState.Attacking;
   curAnim = simpleAttack.getAnimation(heading);
   manager.registerAttack(simpleAttack);
   simpleAttack.activate();
 }