/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package transientlibs.preui.agents.factories;
import transientlibs.slick2d.util.Log;
import transientlibs.maps.entities.Bullet;
import transientlibs.maps.units.Unit;
import transientlibs.bindedobjects.core.Binding;
import transientlibs.bindedobjects.gamecontent.Creatures;
import transientlibs.bindedobjects.core.datasets.Landmarks;
import transientlibs.bindedobjects.gamecontent.Cards;
import transientlibs.objects.creatures.items.Item;
import transientlibs.objects.cards.Deck;
import transientlibs.processors.misc.Detonator;
import transientlibs.maps.board.BoardUnit;
import transientlibs.maps.board.CombatBoard;
import transientlibs.maps.implementation.TilelessMap;
import transientlibs.maps.units.GenericUnit;
import transientlibs.maps.entities.Landmark;
import transientlibs.maps.implementation.BasicMap;
import transientlibs.preui.objects.states.TransientTiledMapState;
/**
*
* @author kibertoad
*/
public class AbstractCreatureFactory {
public TransientTiledMapState state;
public Landmark produceLandmark(int landmarkID, int onX, int onY, TilelessMap onMap) {
Log.info("Produce LM: " + Landmarks.getLandmarkByID(landmarkID).name() + " (" + landmarkID + ")");
Landmark newLandmark;
newLandmark = new Landmark(onX, onY, landmarkID, onMap);
if (onMap != null) {
onMap.placeLandmark(onX, onY, newLandmark);
} else {
Detonator.INSTANCE.landmarks.add(newLandmark);
}
return newLandmark;
}
public Item produceItem(int itemID, int onX, int onY, BasicMap onMap) {
onMap.tile[onX][onY].items.newItemByID(itemID);
return onMap.tile[onX][onY].items.items.get(onMap.tile[onX][onY].items.items.size() - 1);
}
public GenericUnit produceUnit(int creatureID, int onX, int onY, TilelessMap onMap) {
Unit newUnit;
newUnit = new Unit(onX, onY, creatureID, onMap);
if (onMap != null) {
onMap.placeUnit(onX, onY, newUnit);
//Log.info("Placed unit");
} else {
Log.error("No map!");
//Detonator.INSTANCE.units.add(newUnit);
}
if (newUnit.creature.hasTag("pc")) {
onMap.player = newUnit;
}
if (Detonator.INSTANCE.useGDXImages) {
newUnit.setImage(newUnit.creature.masterImage);
}
if (newUnit.creature.cards != null) {
Log.warn("DECK TIME");
newUnit.deck = new Deck();
for (Cards c : newUnit.creature.cards) {
newUnit.deck.addCard(c);
}
}
if (Detonator.INSTANCE.useBox2D == true) {
Detonator.INSTANCE.bodyFactory.materializeUnit(onMap.getWorld(), newUnit);
}
Detonator.INSTANCE.brainFactory.produceBrain(newUnit);
return newUnit;
}
public BoardUnit produceBoardUnit(String creatureCode, int setSide, CombatBoard onBoard) {
return null;
}
public BoardUnit produceBoardUnit(Creatures creature, int setSide, CombatBoard onBoard) {
return null;
}
public GenericUnit produceUnit(String creatureCode, int onX, int onY, TilelessMap onMap) {
return produceUnit(Binding.readBinding(Binding.creatureBinding, creatureCode), onX, onY, onMap);
}
public Landmark produceLandmark(String landmarkCode, int onX, int onY, TilelessMap onMap) {
Landmark newLandmark = produceLandmark(Binding.readBinding(Binding.landmarkBinding, landmarkCode), onX, onY, onMap);
newLandmark.calcImagePosition();
return newLandmark;
}
public Bullet produceBullet(int setDamage, int setType, int toX, int toY, double vectorX, double vectorY, int onSide, TilelessMap onMap) {
return null;
}
}