Package marauroa.common.game

Examples of marauroa.common.game.RPAction


   */
  @Test(expected = NumberFormatException.class)
  public void testOnActionWrongValue() {
    final OutfitAction oa = new OutfitAction();
    final Player player = PlayerTestHelper.createPlayer("player");
    final RPAction action = new RPAction();
    action.put("value", "schnick");
    oa.onAction(player, action);
  }
View Full Code Here


   */
  @Test
  public void testOnAction() {
    final OutfitAction oa = new OutfitAction();
    final Player player = PlayerTestHelper.createPlayer("player");
    final RPAction action = new RPAction();
    assertNotNull(player.get("outfit"));
    action.put("value", 1);
    oa.onAction(player, action);
    assertTrue(player.has("outfit"));
    assertEquals("1", player.get("outfit"));

    action.put("value", 51515151);
    oa.onAction(player, action);
    assertTrue(player.has("outfit"));
    assertEquals("invalid player outfit", "1", player.get("outfit"));
  }
View Full Code Here

  /**
   * Tests for playerIsNull.
   */
  @Test(expected = NullPointerException.class)
  public void testPlayerIsNull() {
    final RPAction action = new RPAction();
    action.put("type", "away");
    final AwayAction aa = new AwayAction();
    aa.onAction(null, action);
  }
View Full Code Here

   * Tests for onAction.
   */
  @Test
  public void testOnAction() {
    final Player bob = PlayerTestHelper.createPlayer("bob");
    final RPAction action = new RPAction();
    action.put("type", "away");
    final AwayAction aa = new AwayAction();
    aa.onAction(bob, action);
    assertEquals(null, bob.getAwayMessage());
    action.put("message", "bla");
    aa.onAction(bob, action);
    assertEquals("bla", bob.getAwayMessage());
  }
View Full Code Here

   */
  @Test
  public void testOnInvalidAction() {
    final Player bob = PlayerTestHelper.createPlayer("bob");
    bob.clearEvents();
    final RPAction action = new RPAction();
    action.put("type", "bla");
    action.put("message", "bla");
    final AwayAction aa = new AwayAction();
    aa.onAction(bob, action);
    assertEquals(null, bob.getAwayMessage());
  }
View Full Code Here

        notify = true;

      }

    };
    final RPAction action = new RPAction();
    sa.onAction(player, action);

    assertTrue(notify);
    assertFalse(stopattack);
    action.put("attack", "value");
    notify = false;
    stopattack = false;

    sa.onAction(player, action);
View Full Code Here

   */
  @Test
  public void testOnActionnotAtplayer() {
    final WrapAction wrap = new WrapAction();
    final Player player = PlayerTestHelper.createPlayer("bob");
    final RPAction action = new RPAction();
    action.put("type", "wrap");
    action.put("args", "");
    wrap.onAction(player, action);
    assertThat(player.events().get(0).get("text"), is("You don't have any null"));
    player.clearEvents();

    action.put("args", "blabla");
    wrap.onAction(player, action);
    assertThat(player.events().get(0).get("text"), is("You don't have any null blabla"));

    player.clearEvents();

    action.put("target", "what");
    action.put("args", "blabla");
    wrap.onAction(player, action);
    assertThat(player.events().get(0).get("text"), is("You don't have any what blabla"));
  }
View Full Code Here

    final WrapAction wrap = new WrapAction();
    final Player player = PlayerTestHelper.createPlayer("bob");

    PlayerTestHelper.equipWithItem(player, "potion");

    final RPAction action = new RPAction();
    action.put("type", "wrap");
    action.put("target", "potion");
    wrap.onAction(player, action);
    assertTrue(player.isEquipped("present"));
    final Present present = (Present) player.getFirstEquipped("present");
    assertNotNull(present);
    assertThat(present.getInfoString(), is("potion"));
View Full Code Here

    final WrapAction wrap = new WrapAction();
    final Player player = PlayerTestHelper.createPlayer("bob");

    PlayerTestHelper.equipWithItem(player, "greater potion");

    final RPAction action = new RPAction();
    action.put("type", "wrap");
    action.put("target", "greater");
    action.put("args", "potion");
    wrap.onAction(player, action);
    assertTrue(player.isEquipped("present"));
    final Present present = (Present) player.getFirstEquipped("present");
    assertNotNull(present);
    assertThat(present.getInfoString(), is("greater potion"));
View Full Code Here

    final WrapAction wrap = new WrapAction();
    final Player player = PlayerTestHelper.createPlayer("bob");

    PlayerTestHelper.equipWithItem(player, "mithril shield");

    final RPAction action = new RPAction();
    action.put("type", "wrap");
    action.put("target", "mithril");
    action.put("args", "shield");
    wrap.onAction(player, action);
    assertTrue(player.isEquipped("present"));
    final Present present = (Present) player.getFirstEquipped("present");
    assertNotNull(present);
    assertThat(present.getInfoString(), is("mithril shield"));
View Full Code Here

TOP

Related Classes of marauroa.common.game.RPAction

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.