コード例 #1
0
 @Test
 public void checksCollisionsWithOtherGameObjects() {
   go = new GameObject();
   go.setBoundingBox(new Circle(0, 0, 2));
   GameObject go2 = new GameObject();
   go2.setBoundingBox(new Point(3, 3));
   assertFalse(go.collidesWith(go2));
 }
コード例 #2
0
 @Test
 public void startsDeadAndHasAccessors() {
   assertFalse(go.isAlive());
   go.revive();
   assertTrue(go.isAlive());
   go.kill();
   assertFalse(go.isAlive());
 }
コード例 #3
0
  @Test
  public void tarmogoyf() {
    this.addDeck(
        Tarmogoyf.class,
        Tarmogoyf.class,
        Tarmogoyf.class,
        BlackLotus.class,
        BlackLotus.class,
        Shock.class,
        Shock.class);
    this.addDeck(
        Plains.class,
        Plains.class,
        Plains.class,
        Plains.class,
        Plains.class,
        Plains.class,
        Plains.class);
    startGame(new Open());

    respondWith(getPlayer(0));
    keep();
    keep();

    // pass upkeep
    pass();
    pass();

    respondWith(getSpellAction(BlackLotus.class));
    pass();
    pass();

    respondWith(getSpellAction(Tarmogoyf.class));
    respondWith(getAbilityAction(BlackLotus.BlackLotusMana.class));
    respondWith(Color.GREEN);
    donePlayingManaAbilities();
    respondWith(getMana(Color.GREEN, Color.GREEN));
    pass();
    pass();

    assertTrue(this.game.actualState.battlefield().objects.get(0).getName().equals("Tarmogoyf"));
    assertEquals(1, this.game.actualState.battlefield().objects.get(0).getPower());
    assertEquals(2, this.game.actualState.battlefield().objects.get(0).getToughness());

    respondWith(getSpellAction(BlackLotus.class));
    pass();
    pass();

    respondWith(getSpellAction(Shock.class));
    respondWith(getTarget(Tarmogoyf.class));
    respondWith(getAbilityAction(BlackLotus.BlackLotusMana.class));
    respondWith(Color.RED);
    donePlayingManaAbilities();
    respondWith(getMana(Color.RED));
    pass();
    pass();

    assertTrue(this.game.actualState.battlefield().objects.get(0).getName().equals("Tarmogoyf"));
    assertEquals(2, this.game.actualState.battlefield().objects.get(0).getPower());
    assertEquals(3, this.game.actualState.battlefield().objects.get(0).getToughness());
    assertEquals(2, this.game.actualState.battlefield().objects.get(0).getDamage());

    respondWith(getSpellAction(Shock.class));
    respondWith(getTarget(Tarmogoyf.class));
    donePlayingManaAbilities();
    respondWith(getMana(Color.RED));
    pass();
    pass();

    // tarmogoyf should be 3/4 and dead -- it counts itself since it's in
    // the yard now!
    GameObject tarmy = this.game.actualState.get(getGraveyard(0).objects.get(0).ID);
    assertEquals(0, this.game.actualState.battlefield().objects.size());
    assertTrue(tarmy.getName().equals("Tarmogoyf"));
    assertEquals(3, tarmy.getPower());
    assertEquals(4, tarmy.getToughness());
  }