congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
ActionComponent.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.cardshifter.modapi.actions.ActionComponent
constructor

Best Java code snippets using com.cardshifter.modapi.actions.ActionComponent.<init> (Showing top 7 results out of 315)

origin: Cardshifter/Cardshifter

@Override
public Component copy(Entity copyTo) {
  ActionComponent copy = new ActionComponent();
  for (Entry<String, ECSAction> entry : actions.entrySet()) {
    copy.addAction(entry.getValue().copy(copyTo));
  }
  return copy;
}
origin: Cardshifter/Cardshifter

private void giveReplayControls(Entity player) {
  ActionComponent actions = player.getComponent(ActionComponent.class);
  if (actions == null) {
    actions = new ActionComponent();
    player.addComponent(actions);
  }
  actions.addAction(new ECSAction(player, NEXT_STEP, e -> true, this::nextStep));
}

origin: Cardshifter/Cardshifter

@Override
public void startGame(ECSGame game) {
  ComponentRetriever<ActionComponent> actions = ComponentRetriever.retreiverFor(ActionComponent.class);
  game.getEvents().registerHandlerAfter(this, TargetableCheckEvent.class, this::targetAllowed);
  game.getEvents().registerHandlerAfter(this, ActionAllowedCheckEvent.class, this::actionAllowed);
  
  Set<Entity> players = game.getEntitiesWithComponent(PlayerComponent.class);
  remainingPerforms.set(players.size());
  for (Entity player : players) {
    ActionComponent playerActions = player.get(actions);
    if (playerActions == null) {
      playerActions = new ActionComponent();
      player.addComponent(playerActions);
    }
    playerActions.addAction(createMulliganAction(player));
  }
}
origin: Cardshifter/Cardshifter

@Before
public void before() {
  game = new ECSGame();
  entity = game.newEntity().addComponent(new ActionComponent());
}
origin: Cardshifter/Cardshifter

@Test
public void removeSystemTest() {
  ECSGame game = new ECSGame();
  ActionComponent act = new ActionComponent();
  Entity entity = game.newEntity().addComponent(act);
  act.addAction(new ECSAction(entity, "Test", e -> true, e -> {}));
  system = new SpecificActionSystem("Test") {
    @Override
    protected void onPerform(ActionPerformEvent event) {
      value.getAndIncrement();
      event.getEntity().getGame().removeSystem(system);
    }
  };
  game.addSystem(system);
  
  game.startGame();
  
  assertEquals(0, value.get());
  act.getAction("Test").perform(entity);
  assertEquals(1, value.get());
  act.getAction("Test").perform(entity);
  assertEquals(1, value.get());
  
  game.addSystem(system);
  act.getAction("Test").perform(entity);
  assertEquals(2, value.get());
}
origin: Cardshifter/Cardshifter

private void createCards(ZoneComponent hand) {
  for (int i = 0; i < 5; i++) {
    Entity entity = hand.getOwner().getGame().newEntity();
    ECSResourceMap.createFor(entity)
        .set(CyborgChroniclesGame.CyborgChroniclesResources.HEALTH, 3)
        .set(CyborgChroniclesGame.CyborgChroniclesResources.MAX_HEALTH, 3);
    ECSAttributeMap.createFor(entity).set(Attributes.NAME, "Test");
    ActionComponent action = new ActionComponent();
    entity.addComponent(action);
    action.addAction(moveAction("Field", entity, BattlefieldComponent.class, false));
    action.addAction(moveAction("Hand", entity, HandComponent.class, false));
    action.addAction(moveAction("Deck", entity, DeckComponent.class, false));
    action.addAction(moveAction("2-Field", entity, BattlefieldComponent.class, true));
    action.addAction(moveAction("2-Hand", entity, HandComponent.class, true));
    action.addAction(moveAction("2-Deck", entity, DeckComponent.class, true));
    action.addAction(damageAction(entity));
    hand.addOnBottom(entity);
  }
}
origin: Cardshifter/Cardshifter

phaseController.addPhase(playerPhase);
ActionComponent actions = new ActionComponent();
player.addComponent(actions);
com.cardshifter.modapi.actionsActionComponent<init>

Popular methods of ActionComponent

  • addAction
  • getAction
  • getECSActions
  • getActions
  • removeAction

Popular in Java

  • Creating JSON documents from java classes using gson
  • startActivity (Activity)
  • findViewById (Activity)
  • setRequestProperty (URLConnection)
  • Kernel (java.awt.image)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now