Package games.stendhal.server.events

Examples of games.stendhal.server.events.AttackEvent


      //randomly choose one defensive item to deteriorate
      List<Item> defenseItems = defender.getDefenseItems();
      if(!defenseItems.isEmpty()) {
        Rand.rand(defenseItems).deteriorate();
      }
      player.addEvent(new AttackEvent(true, damage, player.getDamageType()));
    } else {
      // Missed
      logger.debug("attack from " + player.getID() + " to "
          + defender.getID() + ": Missed");
      player.addEvent(new AttackEvent(false, 0, player.getDamageType()));
    }

    if (missileUsed) {
      /*
       *  Removing the missile is deferred here so that the weapon
View Full Code Here


      } else {
        // The attack was too weak, it was blocked
        logger.debug("attack from " + this.getID() + " to "
            + defender.getID() + ": Damage: " + 0);
      }
      addEvent(new AttackEvent(true, damage, getDamageType()));
    } else {
      // Missed
      logger.debug("attack from " + this.getID() + " to "
          + defender.getID() + ": Missed");
      addEvent(new AttackEvent(false, 0, getDamageType()));
    }

    this.notifyWorldAboutChanges();

    return result;
View Full Code Here

    }

    assertFalse(attacker.attack());

    assertNotNull(attacker.getAttackTarget());
    AttackEvent attack = null;
    for (RPEvent ev : attacker.events()) {
      if (ev instanceof AttackEvent) {
        attack = (AttackEvent) ev;
        continue;
      }
    }
    assertNotNull(attack);
    assertTrue(attack.has("hit"));
    assertTrue(attack.has("damage"));
    assertThat("no damage done ", attack.get("damage"), is("0"));
  }
View Full Code Here

    assertTrue(attacker.attack());

    assertNotNull(attacker.getAttackTarget());
   
    AttackEvent attack = null;
    for (RPEvent ev : attacker.events()) {
      if (ev instanceof AttackEvent) {
        attack = (AttackEvent) ev;
        continue;
      }
    }
    assertNotNull(attack);
    assertTrue(attack.has("hit"));
    assertTrue(attack.has("damage"));
    assertThat("no damage done ", attack.get("damage"), is("30"));
  }
View Full Code Here

TOP

Related Classes of games.stendhal.server.events.AttackEvent

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.