com.cardshifter.modapi.cards.ZoneComponent.getOwner()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中com.cardshifter.modapi.cards.ZoneComponent.getOwner()方法的一些代码示例,展示了ZoneComponent.getOwner()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneComponent.getOwner()方法的具体详情如下:
包路径:com.cardshifter.modapi.cards.ZoneComponent
类名称:ZoneComponent
方法名:getOwner

ZoneComponent.getOwner介绍

暂无

代码示例

代码示例来源:origin: Cardshifter/Cardshifter

public Entity getOwner() {
    ZoneComponent zone = getCurrentZone();
//        Objects.requireNonNull(getCurrentZone(), "Card is not on any zone: " + Entity.debugInfo(getEntity()));
    return zone == null ? null : zone.getOwner();
  }

代码示例来源:origin: Cardshifter/Cardshifter

/**
 * Zones are treated differently when they are known to the target player.
 * 
 * @param zone The zone component object
 * @param player The target player for the message
 * @return A zone message constructed based on the zone component object properties.
 */
private ZoneMessage constructZoneMessage(ZoneComponent zone, Entity player) {
  return new ZoneMessage(zone.getZoneId(), zone.getName(), 
      zone.getOwner().getId(), zone.size(), zone.isKnownTo(player), zone.stream().mapToInt(e -> e.getId()).toArray());
}

代码示例来源:origin: Cardshifter/Cardshifter

public static boolean isOwnedByCurrentPlayer(Entity entity) {
  CardComponent cardData = card.required(entity);
  
  return cardData.getCurrentZone().getOwner() == phase.get(entity).getCurrentPhase().getOwner();
}

代码示例来源: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);
  }
}

相关文章