Skip to content

Commit

Permalink
Corrected spelling of ResourceRetrIEver
Browse files Browse the repository at this point in the history
  • Loading branch information
Zomis committed Sep 19, 2014
1 parent 87d9ef2 commit 253f036
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
import net.zomis.cardshifter.ecs.cards.CardComponent;
import net.zomis.cardshifter.ecs.components.PlayerComponent;
import net.zomis.cardshifter.ecs.resources.ECSResource;
import net.zomis.cardshifter.ecs.resources.ResourceRetreiver;
import net.zomis.cardshifter.ecs.resources.ResourceRetriever;

public class AttackDamageYGO extends SpecificActionSystem {

private final ResourceRetreiver attack;
private final ResourceRetreiver health;
private final ResourceRetriever attack;
private final ResourceRetriever health;

public AttackDamageYGO(ECSResource attack, ECSResource health) {
super("Attack");
this.attack = ResourceRetreiver.forResource(attack);
this.health = ResourceRetreiver.forResource(health);
this.attack = ResourceRetriever.forResource(attack);
this.health = ResourceRetriever.forResource(health);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

import net.zomis.cardshifter.ecs.base.Entity;

public class ResourceRetreiver {
public class ResourceRetriever {

private final ECSResource resource;

private ResourceRetreiver(ECSResource resource) {
ResourceRetriever(ECSResource resource) {
this.resource = resource;
}

public static ResourceRetreiver forResource(ECSResource resource) {
return new ResourceRetreiver(resource);
public static ResourceRetriever forResource(ECSResource resource) {
return new ResourceRetriever(resource);
}

public int getFor(Entity entity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ public static Map<String, Integer> map(Entity playerFor) {
return result;
}

public static ResourceRetriever retriever(ECSResource resource) {
return new ResourceRetriever(resource);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
public class RestoreResourcesToSystem implements ECSSystem {

private final Predicate<Entity> entityPredicate;
private final ResourceRetreiver resource;
private final ResourceRetriever resource;
private final ToIntFunction<Entity> valueGetter;

public RestoreResourcesToSystem(Predicate<Entity> entities, ECSResource resource, ToIntFunction<Entity> valueGetter) {
this.entityPredicate = entities;
this.resource = ResourceRetreiver.forResource(resource);
this.resource = ResourceRetriever.forResource(resource);
this.valueGetter = valueGetter;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import net.zomis.cardshifter.ecs.actions.ActionPerformEvent;
import net.zomis.cardshifter.ecs.actions.SpecificActionSystem;
import net.zomis.cardshifter.ecs.resources.ECSResource;
import net.zomis.cardshifter.ecs.resources.ResourceRetreiver;
import net.zomis.cardshifter.ecs.resources.ResourceRetriever;

public class AttackSickness extends SpecificActionSystem {

private final ResourceRetreiver resource;
private final ResourceRetriever resource;

public AttackSickness(ECSResource resource) {
super("Attack");
this.resource = ResourceRetreiver.forResource(resource);
this.resource = ResourceRetriever.forResource(resource);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
import net.zomis.cardshifter.ecs.base.ECSSystem;
import net.zomis.cardshifter.ecs.cards.DrawCardFailedEvent;
import net.zomis.cardshifter.ecs.resources.ECSResource;
import net.zomis.cardshifter.ecs.resources.ResourceRetreiver;
import net.zomis.cardshifter.ecs.resources.ResourceRetriever;

public class DamageConstantWhenOutOfCardsSystem implements ECSSystem {

private final int damage;
private final ResourceRetreiver resource;
private final ResourceRetriever resource;

public DamageConstantWhenOutOfCardsSystem(ECSResource resource, int damage) {
this.damage = damage;
this.resource = ResourceRetreiver.forResource(resource);
this.resource = ResourceRetriever.forResource(resource);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
import net.zomis.cardshifter.ecs.base.Entity;
import net.zomis.cardshifter.ecs.resources.ECSResource;
import net.zomis.cardshifter.ecs.resources.ECSResourceData;
import net.zomis.cardshifter.ecs.resources.ResourceRetreiver;
import net.zomis.cardshifter.ecs.resources.ResourceRetriever;

public class UseCostSystem extends SpecificActionSystem {

private final ToIntFunction<Entity> cost;
private final UnaryOperator<Entity> whoPays;
private final ResourceRetreiver useResource;
private final ResourceRetriever useResource;

public UseCostSystem(String action, ECSResource useResource, ToIntFunction<Entity> cost, UnaryOperator<Entity> whoPays) {
super(action);
this.useResource = ResourceRetreiver.forResource(useResource);
this.useResource = ResourceRetriever.forResource(useResource);
this.cost = cost;
this.whoPays = whoPays;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.zomis.cardshifter.ecs.actions.SpecificActionSystem;
import net.zomis.cardshifter.ecs.base.Entity;
import net.zomis.cardshifter.ecs.resources.ECSResource;
import net.zomis.cardshifter.ecs.resources.ResourceRetreiver;
import net.zomis.cardshifter.ecs.resources.ResourceRetriever;

public class EnchantPerform extends SpecificActionSystem {

Expand All @@ -23,7 +23,7 @@ protected void onPerform(ActionPerformEvent event) {
Entity enchantment = event.getEntity();

for (ECSResource resource : resources) {
ResourceRetreiver res = ResourceRetreiver.forResource(resource);
ResourceRetriever res = ResourceRetriever.forResource(resource);
int enchantmentValue = res.getFor(enchantment);
res.resFor(target).change(enchantmentValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import net.zomis.cardshifter.ecs.phase.PhaseController;
import net.zomis.cardshifter.ecs.resources.ECSResource;
import net.zomis.cardshifter.ecs.resources.ECSResourceMap;
import net.zomis.cardshifter.ecs.resources.ResourceRetreiver;
import net.zomis.cardshifter.ecs.resources.ResourceRetriever;
import net.zomis.cardshifter.ecs.resources.RestoreResourcesToSystem;
import net.zomis.cardshifter.ecs.systems.AttackOnBattlefield;
import net.zomis.cardshifter.ecs.systems.AttackSickness;
Expand Down Expand Up @@ -98,12 +98,12 @@ public static ECSGame createGame() {
}
}

ResourceRetreiver manaMaxResource = ResourceRetreiver.forResource(PhrancisResources.MANA_MAX);
ResourceRetreiver manaResource = ResourceRetreiver.forResource(PhrancisResources.MANA);
ResourceRetriever manaMaxResource = ResourceRetriever.forResource(PhrancisResources.MANA_MAX);
ResourceRetriever manaResource = ResourceRetriever.forResource(PhrancisResources.MANA);
manaMaxResource.resFor(phaseController.getCurrentEntity()).change(1);
manaResource.resFor(phaseController.getCurrentEntity()).change(1);

ResourceRetreiver manaCostResource = ResourceRetreiver.forResource(PhrancisResources.MANA_COST);
ResourceRetriever manaCostResource = ResourceRetriever.forResource(PhrancisResources.MANA_COST);
UnaryOperator<Entity> owningPlayerPays = entity -> entity.getComponent(CardComponent.class).getOwner();
game.addSystem(new GainResourceSystem(PhrancisResources.MANA_MAX, entity -> Math.min(1, Math.abs(manaMaxResource.getFor(entity) - 10))));
game.addSystem(new RestoreResourcesSystem(PhrancisResources.MANA, entity -> manaMaxResource.getFor(entity)));
Expand All @@ -114,7 +114,7 @@ public static ECSGame createGame() {
game.addSystem(new UseCostSystem(PLAY_ACTION, PhrancisResources.MANA, manaCostResource::getFor, owningPlayerPays));

// Actions - Scrap
ResourceRetreiver scrapCostResource = ResourceRetreiver.forResource(PhrancisResources.SCRAP_COST);
ResourceRetriever scrapCostResource = ResourceRetriever.forResource(PhrancisResources.SCRAP_COST);
game.addSystem(new ScrapSystem(PhrancisResources.SCRAP));

// Actions - Attack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
import net.zomis.cardshifter.ecs.cards.CardComponent;
import net.zomis.cardshifter.ecs.cards.Cards;
import net.zomis.cardshifter.ecs.resources.ECSResource;
import net.zomis.cardshifter.ecs.resources.ResourceRetreiver;
import net.zomis.cardshifter.ecs.resources.ResourceRetriever;

public class ScrapSystem extends SpecificActionSystem {

private final ResourceRetreiver resource;
private final ResourceRetriever resource;

public ScrapSystem(ECSResource resource) {
super("Scrap");
this.resource = ResourceRetreiver.forResource(resource);
this.resource = ResourceRetriever.forResource(resource);
}

private final ComponentRetriever<CardComponent> card = ComponentRetriever.retreiverFor(CardComponent.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import net.zomis.cardshifter.ecs.phase.PhaseController;
import net.zomis.cardshifter.ecs.resources.ECSResource;
import net.zomis.cardshifter.ecs.resources.ECSResourceData;
import net.zomis.cardshifter.ecs.resources.ResourceRetreiver;
import net.zomis.cardshifter.ecs.resources.ResourceRetriever;
import net.zomis.cardshifter.ecs.usage.PhrancisGame;
import net.zomis.cardshifter.ecs.usage.PhrancisGame.PhrancisResources;

Expand All @@ -39,11 +39,11 @@ public class PhrancisTest {

private ECSGame game;
private PhaseController phase;
private final ResourceRetreiver mana = ResourceRetreiver.forResource(PhrancisResources.MANA);
private final ResourceRetreiver manaCost = ResourceRetreiver.forResource(PhrancisResources.MANA_COST);
private final ResourceRetreiver health = ResourceRetreiver.forResource(PhrancisResources.HEALTH);
private final ResourceRetreiver attackPoints = ResourceRetreiver.forResource(PhrancisResources.ATTACK_AVAILABLE);
private final ResourceRetreiver scrapCost = ResourceRetreiver.forResource(PhrancisResources.SCRAP_COST);
private final ResourceRetriever mana = ResourceRetriever.forResource(PhrancisResources.MANA);
private final ResourceRetriever manaCost = ResourceRetriever.forResource(PhrancisResources.MANA_COST);
private final ResourceRetriever health = ResourceRetriever.forResource(PhrancisResources.HEALTH);
private final ResourceRetriever attackPoints = ResourceRetriever.forResource(PhrancisResources.ATTACK_AVAILABLE);
private final ResourceRetriever scrapCost = ResourceRetriever.forResource(PhrancisResources.SCRAP_COST);

private final ComponentRetriever<ActionComponent> actions = ComponentRetriever.retreiverFor(ActionComponent.class);
private final ComponentRetriever<DeckComponent> deck = ComponentRetriever.retreiverFor(DeckComponent.class);
Expand Down Expand Up @@ -162,7 +162,7 @@ private Predicate<Entity> isCreatureType(String creatureType) {
}

private void assertResource(Entity entity, ECSResource resource, int expected) {
ResourceRetreiver retriever = ResourceRetreiver.forResource(resource);
ResourceRetriever retriever = ResourceRetriever.forResource(resource);
ECSResourceData res = retriever.resFor(entity);
assertEquals("Unexpected resource " + resource + " for " + entity, expected, res.get());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import net.zomis.cardshifter.ecs.actions.TargetSet;
import net.zomis.cardshifter.ecs.base.ComponentRetriever;
import net.zomis.cardshifter.ecs.base.Entity;
import net.zomis.cardshifter.ecs.resources.ResourceRetreiver;
import net.zomis.cardshifter.ecs.resources.ResourceRetriever;
import net.zomis.cardshifter.ecs.usage.PhrancisGame.PhrancisResources;

public class CardNodeBattlefield extends Group {
Expand All @@ -28,9 +28,9 @@ public class CardNodeBattlefield extends Group {
private final boolean isPlayer;
private final Entity performer;

private static final ResourceRetreiver resHealth = ResourceRetreiver.forResource(PhrancisResources.HEALTH);
private static final ResourceRetreiver resAttack = ResourceRetreiver.forResource(PhrancisResources.ATTACK);
private static final ResourceRetreiver resManaCost = ResourceRetreiver.forResource(PhrancisResources.MANA_COST);
private static final ResourceRetriever resHealth = ResourceRetriever.forResource(PhrancisResources.HEALTH);
private static final ResourceRetriever resAttack = ResourceRetriever.forResource(PhrancisResources.ATTACK);
private static final ResourceRetriever resManaCost = ResourceRetriever.forResource(PhrancisResources.MANA_COST);
private static final ComponentRetriever<ActionComponent> actions = ComponentRetriever.retreiverFor(ActionComponent.class);

public CardNodeBattlefield (Pane pane, int numCards, String name, Entity card, FXMLGameController controller, boolean isPlayer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import net.zomis.cardshifter.ecs.cards.ZoneComponent;
import net.zomis.cardshifter.ecs.components.PlayerComponent;
import net.zomis.cardshifter.ecs.phase.PhaseController;
import net.zomis.cardshifter.ecs.resources.ResourceRetreiver;
import net.zomis.cardshifter.ecs.resources.ResourceRetriever;
import net.zomis.cardshifter.ecs.usage.PhrancisGame;
import net.zomis.cardshifter.ecs.usage.PhrancisGame.PhrancisResources;

Expand All @@ -34,10 +34,10 @@ public class FXMLGameController {
private ECSGame game;
private boolean gameHasStarted = false; // hack to make the buttons work properly
private PhaseController phases;
private final ResourceRetreiver health = ResourceRetreiver.forResource(PhrancisResources.HEALTH);
private final ResourceRetreiver mana = ResourceRetreiver.forResource(PhrancisResources.MANA);
private final ResourceRetreiver manaMax = ResourceRetreiver.forResource(PhrancisResources.MANA_MAX);
private final ResourceRetreiver scrap = ResourceRetreiver.forResource(PhrancisResources.SCRAP);
private final ResourceRetriever health = ResourceRetriever.forResource(PhrancisResources.HEALTH);
private final ResourceRetriever mana = ResourceRetriever.forResource(PhrancisResources.MANA);
private final ResourceRetriever manaMax = ResourceRetriever.forResource(PhrancisResources.MANA_MAX);
private final ResourceRetriever scrap = ResourceRetriever.forResource(PhrancisResources.SCRAP);

@FXML
Pane anchorPane;
Expand Down

0 comments on commit 253f036

Please sign in to comment.