diff --git a/core/src/fr/evolving/UI/Menu.java b/core/src/fr/evolving/UI/Menu.java index 04b9c5f..06c992f 100644 --- a/core/src/fr/evolving/UI/Menu.java +++ b/core/src/fr/evolving/UI/Menu.java @@ -267,6 +267,10 @@ public class Menu extends Actor { this.setMenuTransmuter(1, 2, ">100", Angular.A00,1); this.setMenuTransmuter(0, 7, "+/",Angular.A00,0); this.setMenuTransmuter(1, 7, "-/",Angular.A00,0); + this.setMenuTransmuter(0, 6, "=+",Angular.A90,0); + this.setMenuTransmuter(1, 6, "=-",Angular.A90,0); + this.setMenuTransmuter(2, 6, "=!",Angular.A90,0); + this.setMenuTransmuter(3, 6, "=E",Angular.A90,0); this.unSelect(); } diff --git a/core/src/fr/evolving/assets/AssetLoader.java b/core/src/fr/evolving/assets/AssetLoader.java index 4b8c9cb..1188664 100644 --- a/core/src/fr/evolving/assets/AssetLoader.java +++ b/core/src/fr/evolving/assets/AssetLoader.java @@ -29,6 +29,10 @@ import com.badlogic.gdx.utils.viewport.ScalingViewport; import com.badlogic.gdx.utils.viewport.StretchViewport; import com.badlogic.gdx.Application; +import fr.evolving.automata.FilterActivable; +import fr.evolving.automata.FilterBig; +import fr.evolving.automata.FilterNegative; +import fr.evolving.automata.FilterPositive; import fr.evolving.automata.Insufler100; import fr.evolving.automata.Insufler33; import fr.evolving.automata.Insufler50; @@ -200,6 +204,10 @@ public class AssetLoader { allTransmuter.add(new Insufler100(null)); allTransmuter.add(new Insufler33(null)); allTransmuter.add(new Insufler50(null)); + allTransmuter.add(new FilterPositive(null)); + allTransmuter.add(new FilterNegative(null)); + allTransmuter.add(new FilterBig(null)); + allTransmuter.add(new FilterActivable(null)); for (Transmuter transmuter : allTransmuter) { Values allTiles = transmuter.getTilesid().iterator(); while (allTiles.hasNext()) { diff --git a/core/src/fr/evolving/automata/FilterActivable.java b/core/src/fr/evolving/automata/FilterActivable.java new file mode 100644 index 0000000..7d564b8 --- /dev/null +++ b/core/src/fr/evolving/automata/FilterActivable.java @@ -0,0 +1,283 @@ +package fr.evolving.automata; + +import java.util.Iterator; + +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.Array; +import com.badlogic.gdx.utils.ObjectMap.Values; +import com.badlogic.gdx.utils.OrderedMap; + +import fr.evolving.assets.AssetLoader; +import fr.evolving.automata.Transmuter.CaseType; +import fr.evolving.automata.Transmuter.Class; + +public class FilterActivable extends Transmuter { + private static String Name, Desc; + private static Class theClass; + private static int Price; + private static int Technology; + private static int Research; + private static Transmuter Upgrade; + private static Array Unlock; + private static boolean showed; + private static boolean CanUpgradeTemp; + private static boolean CanUpgradeCycle; + private static boolean CanUpgradeRayon; + private static boolean CanUpgradeNrj; + private static float UpgradedTemp; + private static float UpgradedCycle; + private static float UpgradedRayon; + private static float UpgradedNrj; + private static float UsedTemp; + private static float UsedRayon; + private static float UsedNrj; + private static float TurnTemp; + private static float TurnRayon; + private static float TurnNrj; + private static boolean Activable; + private transient int ActivationLevel; + private static String id; + private static OrderedMap Tilestype; + private static OrderedMap Tilesid; + + public FilterActivable(Level level) { + super(level); + this.id="=!"; + this.Name = AssetLoader.language.get("[filteractivable-name]"); + this.Desc = AssetLoader.language.get("[filteractivable-desc]"); + this.theClass = Class.Filtrage; + this.Price = 200; + this.Technology = 8; + this.Research = 0; + this.Upgrade = null; + this.Unlock = null; + this.showed = true; + this.CanUpgradeTemp = true; + this.CanUpgradeCycle = true; + this.CanUpgradeRayon = false; + this.CanUpgradeNrj = false; + this.UpgradedTemp = 1f; + this.UpgradedCycle = 1f; + this.UpgradedRayon = 1f; + this.UpgradedNrj = 1f; + this.UsedTemp = 0.2f; + this.UsedRayon = 0f; + this.UsedNrj = 0f; + this.TurnTemp = 0f; + this.TurnRayon = 0f; + this.TurnNrj = 0f; + this.Activable = false; + this.ActivationLevel = 0; + this.Tilestype = new OrderedMap(); + this.Tilestype.put(new Vector2(1, 0), CaseType.Rien); + this.Tilestype.put(new Vector2(-1, 0), CaseType.Rien); + this.Tilestype.put(new Vector2(0, 0), CaseType.Tout); + this.Tilesid = new OrderedMap(); + this.Tilesid.put(new Vector2(1, 0), 150); + this.Tilesid.put(new Vector2(-1, 0), 148); + this.Tilesid.put(new Vector2(0, 0), 153); + } + + public String getName() { + return this.Name; + } + + public String getID() { + return this.id; + } + + public String getDesc() { + return this.Desc; + } + + public Class getaClass() { + return this.theClass; + } + + public void savestatic() { + SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj); + } + + public void restorestatic() { + this.UpgradedTemp = this.temp_UpgradedTemp; + this.UpgradedCycle = this.temp_UpgradedCycle; + this.UpgradedRayon = this.temp_UpgradedRayon; + this.UpgradedNrj = this.temp_UpgradedNrj; + this.showed=this.temp_showed; + } + + public void ProcessCycle() { + this.level.Temp += TurnTemp * UpgradedTemp; + this.level.Rayon += TurnRayon * UpgradedRayon; + this.level.Nrj += TurnNrj * UpgradedNrj; + if (this.Activable) + this.ActivationLevel -= 1; + } + + public void Run() { + this.level.Temp += UsedTemp * UpgradedTemp; + this.level.Rayon += UsedRayon * UpgradedRayon; + this.level.Nrj += UsedNrj * UpgradedNrj; + } + + + public void Activate() { + if (this.Activable) + ActivationLevel = this.getMaxActivationLevel(); + } + + public void UpgradeTemp() { + if (isUpgradableTemp()) + UpgradedTemp += -0.2f; + } + + public void UpgradeNrj() { + if (isUpgradableNrj()) + UpgradedNrj += -0.2f; + } + + public void UpgradeRayon() { + if (isUpgradableRayon()) + UpgradedRayon += -0.2f; + } + + public void UpgradeCycle() { + if (isUpgradableCycle()) + UpgradedCycle += 0.2f; + } + + public Values getTilesid() { + return Tilesid.values(); + } + + public CaseType getTilestype(int order) { + return Tilestype.values().toArray().get(order); + } + + public OrderedMap getTilesidrotated() { + OrderedMap newTiles = new OrderedMap(); + Iterator tiles = this.Tilesid.keys(); + while (tiles.hasNext()) { + Vector2 key = tiles.next(); + double delta = key.len(); + double alpha = key.angleRad() + this.getRotation().ordinal() + * Math.PI / 2; + newTiles.put( + new Vector2((float) Math.round(delta * Math.cos(alpha)), + (float) Math.round(delta * Math.sin(alpha))), + this.Tilesid.get(key)); + } + return newTiles; + } + + public boolean isActivable() { + return this.Activable; + } + + public int getMaxActivationLevel() { + return ActivationLevel = (int) (10 * this.UpgradedCycle); + } + + public int getActivationLevel() { + if (this.Activable) + return ActivationLevel; + else + return -1; + } + + public boolean getActivation() { + if (this.Activable) + return ActivationLevel > 0; + else + return true; + } + + public int getPrice() { + return Price; + } + + public int getSize() { + return (Tilesid.size); + } + + public int getTechnology() { + return Technology; + } + + public int getResearch() { + return Research; + } + + public boolean isShowed() { + return this.showed; + } + + public void SetShowed(boolean value) { + this.showed = value; + } + + public boolean isUpgradableTemp() { + return CanUpgradeTemp && getUpgradeTemp() < 3; + } + + public boolean isUpgradableCycle() { + return CanUpgradeCycle && getUpgradeCycle() < 3; + } + + public boolean isUpgradableRayon() { + return CanUpgradeRayon && getUpgradeRayon() < 3; + } + + public boolean isUpgradableNrj() { + return CanUpgradeNrj && getUpgradeNrj() < 3; + } + + public int getUpgradeTemp() { + return Math.abs((int) ((10 * UpgradedTemp - 10) / 2f)); + } + + public int getUpgradeCycle() { + return Math.abs((int) ((10 * UpgradedCycle - 10) / 2f)); + } + + public int getUpgradeRayon() { + return Math.abs((int) ((10 * UpgradedRayon - 10) / 2f)); + } + + public int getUpgradeNrj() { + return Math.abs((int) ((10 * UpgradedNrj - 10) / 2f)); + } + + public float getUsedTemp() { + return UsedTemp * UpgradedTemp; + } + + public float getUsedRayon() { + return UsedRayon * UpgradedRayon; + } + + public float getUsedNrj() { + return UsedNrj * UpgradedNrj; + } + + public float getTurnTemp() { + return TurnTemp * UpgradedTemp; + } + + public float getTurnRayon() { + return TurnRayon * UpgradedRayon; + } + + public float getTurnNrj() { + return TurnNrj * UpgradedNrj; + } + + public Transmuter getUpgrade() { + return this.Upgrade; + } + + public Array getUnlock() { + return this.Unlock; + } + +} diff --git a/core/src/fr/evolving/automata/FilterBig.java b/core/src/fr/evolving/automata/FilterBig.java new file mode 100644 index 0000000..0edc937 --- /dev/null +++ b/core/src/fr/evolving/automata/FilterBig.java @@ -0,0 +1,283 @@ +package fr.evolving.automata; + +import java.util.Iterator; + +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.Array; +import com.badlogic.gdx.utils.ObjectMap.Values; +import com.badlogic.gdx.utils.OrderedMap; + +import fr.evolving.assets.AssetLoader; +import fr.evolving.automata.Transmuter.CaseType; +import fr.evolving.automata.Transmuter.Class; + +public class FilterBig extends Transmuter { + private static String Name, Desc; + private static Class theClass; + private static int Price; + private static int Technology; + private static int Research; + private static Transmuter Upgrade; + private static Array Unlock; + private static boolean showed; + private static boolean CanUpgradeTemp; + private static boolean CanUpgradeCycle; + private static boolean CanUpgradeRayon; + private static boolean CanUpgradeNrj; + private static float UpgradedTemp; + private static float UpgradedCycle; + private static float UpgradedRayon; + private static float UpgradedNrj; + private static float UsedTemp; + private static float UsedRayon; + private static float UsedNrj; + private static float TurnTemp; + private static float TurnRayon; + private static float TurnNrj; + private static boolean Activable; + private transient int ActivationLevel; + private static String id; + private static OrderedMap Tilestype; + private static OrderedMap Tilesid; + + public FilterBig(Level level) { + super(level); + this.id="=E"; + this.Name = AssetLoader.language.get("[filterbig-name]"); + this.Desc = AssetLoader.language.get("[filterbig-desc]"); + this.theClass = Class.Filtrage; + this.Price = 150; + this.Technology = 5; + this.Research = 0; + this.Upgrade = null; + this.Unlock = null; + this.showed = true; + this.CanUpgradeTemp = true; + this.CanUpgradeCycle = false; + this.CanUpgradeRayon = false; + this.CanUpgradeNrj = false; + this.UpgradedTemp = 1f; + this.UpgradedCycle = 1f; + this.UpgradedRayon = 1f; + this.UpgradedNrj = 1f; + this.UsedTemp = 0.2f; + this.UsedRayon = 0f; + this.UsedNrj = 0f; + this.TurnTemp = 0f; + this.TurnRayon = 0f; + this.TurnNrj = 0f; + this.Activable = false; + this.ActivationLevel = 0; + this.Tilestype = new OrderedMap(); + this.Tilestype.put(new Vector2(1, 0), CaseType.Rien); + this.Tilestype.put(new Vector2(-1, 0), CaseType.Rien); + this.Tilestype.put(new Vector2(0, 0), CaseType.Cuivre); + this.Tilesid = new OrderedMap(); + this.Tilesid.put(new Vector2(1, 0), 150); + this.Tilesid.put(new Vector2(-1, 0), 148); + this.Tilesid.put(new Vector2(0, 0), 152); + } + + public String getName() { + return this.Name; + } + + public String getID() { + return this.id; + } + + public String getDesc() { + return this.Desc; + } + + public Class getaClass() { + return this.theClass; + } + + public void savestatic() { + SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj); + } + + public void restorestatic() { + this.UpgradedTemp = this.temp_UpgradedTemp; + this.UpgradedCycle = this.temp_UpgradedCycle; + this.UpgradedRayon = this.temp_UpgradedRayon; + this.UpgradedNrj = this.temp_UpgradedNrj; + this.showed=this.temp_showed; + } + + public void ProcessCycle() { + this.level.Temp += TurnTemp * UpgradedTemp; + this.level.Rayon += TurnRayon * UpgradedRayon; + this.level.Nrj += TurnNrj * UpgradedNrj; + if (this.Activable) + this.ActivationLevel -= 1; + } + + public void Run() { + this.level.Temp += UsedTemp * UpgradedTemp; + this.level.Rayon += UsedRayon * UpgradedRayon; + this.level.Nrj += UsedNrj * UpgradedNrj; + } + + + public void Activate() { + if (this.Activable) + ActivationLevel = this.getMaxActivationLevel(); + } + + public void UpgradeTemp() { + if (isUpgradableTemp()) + UpgradedTemp += -0.2f; + } + + public void UpgradeNrj() { + if (isUpgradableNrj()) + UpgradedNrj += -0.2f; + } + + public void UpgradeRayon() { + if (isUpgradableRayon()) + UpgradedRayon += -0.2f; + } + + public void UpgradeCycle() { + if (isUpgradableCycle()) + UpgradedCycle += 0.2f; + } + + public Values getTilesid() { + return Tilesid.values(); + } + + public CaseType getTilestype(int order) { + return Tilestype.values().toArray().get(order); + } + + public OrderedMap getTilesidrotated() { + OrderedMap newTiles = new OrderedMap(); + Iterator tiles = this.Tilesid.keys(); + while (tiles.hasNext()) { + Vector2 key = tiles.next(); + double delta = key.len(); + double alpha = key.angleRad() + this.getRotation().ordinal() + * Math.PI / 2; + newTiles.put( + new Vector2((float) Math.round(delta * Math.cos(alpha)), + (float) Math.round(delta * Math.sin(alpha))), + this.Tilesid.get(key)); + } + return newTiles; + } + + public boolean isActivable() { + return this.Activable; + } + + public int getMaxActivationLevel() { + return ActivationLevel = (int) (10 * this.UpgradedCycle); + } + + public int getActivationLevel() { + if (this.Activable) + return ActivationLevel; + else + return -1; + } + + public boolean getActivation() { + if (this.Activable) + return ActivationLevel > 0; + else + return true; + } + + public int getPrice() { + return Price; + } + + public int getSize() { + return (Tilesid.size); + } + + public int getTechnology() { + return Technology; + } + + public int getResearch() { + return Research; + } + + public boolean isShowed() { + return this.showed; + } + + public void SetShowed(boolean value) { + this.showed = value; + } + + public boolean isUpgradableTemp() { + return CanUpgradeTemp && getUpgradeTemp() < 3; + } + + public boolean isUpgradableCycle() { + return CanUpgradeCycle && getUpgradeCycle() < 3; + } + + public boolean isUpgradableRayon() { + return CanUpgradeRayon && getUpgradeRayon() < 3; + } + + public boolean isUpgradableNrj() { + return CanUpgradeNrj && getUpgradeNrj() < 3; + } + + public int getUpgradeTemp() { + return Math.abs((int) ((10 * UpgradedTemp - 10) / 2f)); + } + + public int getUpgradeCycle() { + return Math.abs((int) ((10 * UpgradedCycle - 10) / 2f)); + } + + public int getUpgradeRayon() { + return Math.abs((int) ((10 * UpgradedRayon - 10) / 2f)); + } + + public int getUpgradeNrj() { + return Math.abs((int) ((10 * UpgradedNrj - 10) / 2f)); + } + + public float getUsedTemp() { + return UsedTemp * UpgradedTemp; + } + + public float getUsedRayon() { + return UsedRayon * UpgradedRayon; + } + + public float getUsedNrj() { + return UsedNrj * UpgradedNrj; + } + + public float getTurnTemp() { + return TurnTemp * UpgradedTemp; + } + + public float getTurnRayon() { + return TurnRayon * UpgradedRayon; + } + + public float getTurnNrj() { + return TurnNrj * UpgradedNrj; + } + + public Transmuter getUpgrade() { + return this.Upgrade; + } + + public Array getUnlock() { + return this.Unlock; + } + +} diff --git a/core/src/fr/evolving/automata/FilterNegative.java b/core/src/fr/evolving/automata/FilterNegative.java new file mode 100644 index 0000000..bd54e54 --- /dev/null +++ b/core/src/fr/evolving/automata/FilterNegative.java @@ -0,0 +1,283 @@ +package fr.evolving.automata; + +import java.util.Iterator; + +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.Array; +import com.badlogic.gdx.utils.ObjectMap.Values; +import com.badlogic.gdx.utils.OrderedMap; + +import fr.evolving.assets.AssetLoader; +import fr.evolving.automata.Transmuter.CaseType; +import fr.evolving.automata.Transmuter.Class; + +public class FilterNegative extends Transmuter { + private static String Name, Desc; + private static Class theClass; + private static int Price; + private static int Technology; + private static int Research; + private static Transmuter Upgrade; + private static Array Unlock; + private static boolean showed; + private static boolean CanUpgradeTemp; + private static boolean CanUpgradeCycle; + private static boolean CanUpgradeRayon; + private static boolean CanUpgradeNrj; + private static float UpgradedTemp; + private static float UpgradedCycle; + private static float UpgradedRayon; + private static float UpgradedNrj; + private static float UsedTemp; + private static float UsedRayon; + private static float UsedNrj; + private static float TurnTemp; + private static float TurnRayon; + private static float TurnNrj; + private static boolean Activable; + private transient int ActivationLevel; + private static String id; + private static OrderedMap Tilestype; + private static OrderedMap Tilesid; + + public FilterNegative(Level level) { + super(level); + this.id="=-"; + this.Name = AssetLoader.language.get("[filternegative-name]"); + this.Desc = AssetLoader.language.get("[filternegative-desc]"); + this.theClass = Class.Filtrage; + this.Price = 150; + this.Technology = 6; + this.Research = 0; + this.Upgrade = null; + this.Unlock = null; + this.showed = true; + this.CanUpgradeTemp = true; + this.CanUpgradeCycle = false; + this.CanUpgradeRayon = false; + this.CanUpgradeNrj = false; + this.UpgradedTemp = 1f; + this.UpgradedCycle = 1f; + this.UpgradedRayon = 1f; + this.UpgradedNrj = 1f; + this.UsedTemp = 0.2f; + this.UsedRayon = 0f; + this.UsedNrj = 0f; + this.TurnTemp = 0f; + this.TurnRayon = 0f; + this.TurnNrj = 0f; + this.Activable = false; + this.ActivationLevel = 0; + this.Tilestype = new OrderedMap(); + this.Tilestype.put(new Vector2(1, 0), CaseType.Rien); + this.Tilestype.put(new Vector2(-1, 0), CaseType.Rien); + this.Tilestype.put(new Vector2(0, 0), CaseType.Cuivre); + this.Tilesid = new OrderedMap(); + this.Tilesid.put(new Vector2(1, 0), 150); + this.Tilesid.put(new Vector2(-1, 0), 148); + this.Tilesid.put(new Vector2(0, 0), 149); + } + + public String getName() { + return this.Name; + } + + public String getID() { + return this.id; + } + + public String getDesc() { + return this.Desc; + } + + public Class getaClass() { + return this.theClass; + } + + public void savestatic() { + SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj); + } + + public void restorestatic() { + this.UpgradedTemp = this.temp_UpgradedTemp; + this.UpgradedCycle = this.temp_UpgradedCycle; + this.UpgradedRayon = this.temp_UpgradedRayon; + this.UpgradedNrj = this.temp_UpgradedNrj; + this.showed=this.temp_showed; + } + + public void ProcessCycle() { + this.level.Temp += TurnTemp * UpgradedTemp; + this.level.Rayon += TurnRayon * UpgradedRayon; + this.level.Nrj += TurnNrj * UpgradedNrj; + if (this.Activable) + this.ActivationLevel -= 1; + } + + public void Run() { + this.level.Temp += UsedTemp * UpgradedTemp; + this.level.Rayon += UsedRayon * UpgradedRayon; + this.level.Nrj += UsedNrj * UpgradedNrj; + } + + + public void Activate() { + if (this.Activable) + ActivationLevel = this.getMaxActivationLevel(); + } + + public void UpgradeTemp() { + if (isUpgradableTemp()) + UpgradedTemp += -0.2f; + } + + public void UpgradeNrj() { + if (isUpgradableNrj()) + UpgradedNrj += -0.2f; + } + + public void UpgradeRayon() { + if (isUpgradableRayon()) + UpgradedRayon += -0.2f; + } + + public void UpgradeCycle() { + if (isUpgradableCycle()) + UpgradedCycle += 0.2f; + } + + public Values getTilesid() { + return Tilesid.values(); + } + + public CaseType getTilestype(int order) { + return Tilestype.values().toArray().get(order); + } + + public OrderedMap getTilesidrotated() { + OrderedMap newTiles = new OrderedMap(); + Iterator tiles = this.Tilesid.keys(); + while (tiles.hasNext()) { + Vector2 key = tiles.next(); + double delta = key.len(); + double alpha = key.angleRad() + this.getRotation().ordinal() + * Math.PI / 2; + newTiles.put( + new Vector2((float) Math.round(delta * Math.cos(alpha)), + (float) Math.round(delta * Math.sin(alpha))), + this.Tilesid.get(key)); + } + return newTiles; + } + + public boolean isActivable() { + return this.Activable; + } + + public int getMaxActivationLevel() { + return ActivationLevel = (int) (10 * this.UpgradedCycle); + } + + public int getActivationLevel() { + if (this.Activable) + return ActivationLevel; + else + return -1; + } + + public boolean getActivation() { + if (this.Activable) + return ActivationLevel > 0; + else + return true; + } + + public int getPrice() { + return Price; + } + + public int getSize() { + return (Tilesid.size); + } + + public int getTechnology() { + return Technology; + } + + public int getResearch() { + return Research; + } + + public boolean isShowed() { + return this.showed; + } + + public void SetShowed(boolean value) { + this.showed = value; + } + + public boolean isUpgradableTemp() { + return CanUpgradeTemp && getUpgradeTemp() < 3; + } + + public boolean isUpgradableCycle() { + return CanUpgradeCycle && getUpgradeCycle() < 3; + } + + public boolean isUpgradableRayon() { + return CanUpgradeRayon && getUpgradeRayon() < 3; + } + + public boolean isUpgradableNrj() { + return CanUpgradeNrj && getUpgradeNrj() < 3; + } + + public int getUpgradeTemp() { + return Math.abs((int) ((10 * UpgradedTemp - 10) / 2f)); + } + + public int getUpgradeCycle() { + return Math.abs((int) ((10 * UpgradedCycle - 10) / 2f)); + } + + public int getUpgradeRayon() { + return Math.abs((int) ((10 * UpgradedRayon - 10) / 2f)); + } + + public int getUpgradeNrj() { + return Math.abs((int) ((10 * UpgradedNrj - 10) / 2f)); + } + + public float getUsedTemp() { + return UsedTemp * UpgradedTemp; + } + + public float getUsedRayon() { + return UsedRayon * UpgradedRayon; + } + + public float getUsedNrj() { + return UsedNrj * UpgradedNrj; + } + + public float getTurnTemp() { + return TurnTemp * UpgradedTemp; + } + + public float getTurnRayon() { + return TurnRayon * UpgradedRayon; + } + + public float getTurnNrj() { + return TurnNrj * UpgradedNrj; + } + + public Transmuter getUpgrade() { + return this.Upgrade; + } + + public Array getUnlock() { + return this.Unlock; + } + +} diff --git a/core/src/fr/evolving/automata/FilterPositive.java b/core/src/fr/evolving/automata/FilterPositive.java new file mode 100644 index 0000000..5d93b2e --- /dev/null +++ b/core/src/fr/evolving/automata/FilterPositive.java @@ -0,0 +1,282 @@ +package fr.evolving.automata; + +import java.util.Iterator; + +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.Array; +import com.badlogic.gdx.utils.ObjectMap.Values; +import com.badlogic.gdx.utils.OrderedMap; + +import fr.evolving.assets.AssetLoader; +import fr.evolving.automata.Transmuter.Class; + +public class FilterPositive extends Transmuter { + private static String Name, Desc; + private static Class theClass; + private static int Price; + private static int Technology; + private static int Research; + private static Transmuter Upgrade; + private static Array Unlock; + private static boolean showed; + private static boolean CanUpgradeTemp; + private static boolean CanUpgradeCycle; + private static boolean CanUpgradeRayon; + private static boolean CanUpgradeNrj; + private static float UpgradedTemp; + private static float UpgradedCycle; + private static float UpgradedRayon; + private static float UpgradedNrj; + private static float UsedTemp; + private static float UsedRayon; + private static float UsedNrj; + private static float TurnTemp; + private static float TurnRayon; + private static float TurnNrj; + private static boolean Activable; + private transient int ActivationLevel; + private static String id; + private static OrderedMap Tilestype; + private static OrderedMap Tilesid; + + public FilterPositive(Level level) { + super(level); + this.id="=+"; + this.Name = AssetLoader.language.get("[filterpositive-name]"); + this.Desc = AssetLoader.language.get("[filterpositive-desc]"); + this.theClass = Class.Filtrage; + this.Price = 150; + this.Technology = 6; + this.Research = 0; + this.Upgrade = null; + this.Unlock = null; + this.showed = true; + this.CanUpgradeTemp = true; + this.CanUpgradeCycle = false; + this.CanUpgradeRayon = false; + this.CanUpgradeNrj = false; + this.UpgradedTemp = 1f; + this.UpgradedCycle = 1f; + this.UpgradedRayon = 1f; + this.UpgradedNrj = 1f; + this.UsedTemp = 0.2f; + this.UsedRayon = 0f; + this.UsedNrj = 0f; + this.TurnTemp = 0f; + this.TurnRayon = 0f; + this.TurnNrj = 0f; + this.Activable = false; + this.ActivationLevel = 0; + this.Tilestype = new OrderedMap(); + this.Tilestype.put(new Vector2(1, 0), CaseType.Rien); + this.Tilestype.put(new Vector2(-1, 0), CaseType.Rien); + this.Tilestype.put(new Vector2(0, 0), CaseType.Cuivre); + this.Tilesid = new OrderedMap(); + this.Tilesid.put(new Vector2(1, 0), 150); + this.Tilesid.put(new Vector2(-1, 0), 148); + this.Tilesid.put(new Vector2(0, 0), 151); + } + + public String getName() { + return this.Name; + } + + public String getID() { + return this.id; + } + + public String getDesc() { + return this.Desc; + } + + public Class getaClass() { + return this.theClass; + } + + public void savestatic() { + SetTemp(showed,UpgradedCycle,UpgradedTemp,UpgradedRayon,UpgradedNrj); + } + + public void restorestatic() { + this.UpgradedTemp = this.temp_UpgradedTemp; + this.UpgradedCycle = this.temp_UpgradedCycle; + this.UpgradedRayon = this.temp_UpgradedRayon; + this.UpgradedNrj = this.temp_UpgradedNrj; + this.showed=this.temp_showed; + } + + public void ProcessCycle() { + this.level.Temp += TurnTemp * UpgradedTemp; + this.level.Rayon += TurnRayon * UpgradedRayon; + this.level.Nrj += TurnNrj * UpgradedNrj; + if (this.Activable) + this.ActivationLevel -= 1; + } + + public void Run() { + this.level.Temp += UsedTemp * UpgradedTemp; + this.level.Rayon += UsedRayon * UpgradedRayon; + this.level.Nrj += UsedNrj * UpgradedNrj; + } + + + public void Activate() { + if (this.Activable) + ActivationLevel = this.getMaxActivationLevel(); + } + + public void UpgradeTemp() { + if (isUpgradableTemp()) + UpgradedTemp += -0.2f; + } + + public void UpgradeNrj() { + if (isUpgradableNrj()) + UpgradedNrj += -0.2f; + } + + public void UpgradeRayon() { + if (isUpgradableRayon()) + UpgradedRayon += -0.2f; + } + + public void UpgradeCycle() { + if (isUpgradableCycle()) + UpgradedCycle += 0.2f; + } + + public Values getTilesid() { + return Tilesid.values(); + } + + public CaseType getTilestype(int order) { + return Tilestype.values().toArray().get(order); + } + + public OrderedMap getTilesidrotated() { + OrderedMap newTiles = new OrderedMap(); + Iterator tiles = this.Tilesid.keys(); + while (tiles.hasNext()) { + Vector2 key = tiles.next(); + double delta = key.len(); + double alpha = key.angleRad() + this.getRotation().ordinal() + * Math.PI / 2; + newTiles.put( + new Vector2((float) Math.round(delta * Math.cos(alpha)), + (float) Math.round(delta * Math.sin(alpha))), + this.Tilesid.get(key)); + } + return newTiles; + } + + public boolean isActivable() { + return this.Activable; + } + + public int getMaxActivationLevel() { + return ActivationLevel = (int) (10 * this.UpgradedCycle); + } + + public int getActivationLevel() { + if (this.Activable) + return ActivationLevel; + else + return -1; + } + + public boolean getActivation() { + if (this.Activable) + return ActivationLevel > 0; + else + return true; + } + + public int getPrice() { + return Price; + } + + public int getSize() { + return (Tilesid.size); + } + + public int getTechnology() { + return Technology; + } + + public int getResearch() { + return Research; + } + + public boolean isShowed() { + return this.showed; + } + + public void SetShowed(boolean value) { + this.showed = value; + } + + public boolean isUpgradableTemp() { + return CanUpgradeTemp && getUpgradeTemp() < 3; + } + + public boolean isUpgradableCycle() { + return CanUpgradeCycle && getUpgradeCycle() < 3; + } + + public boolean isUpgradableRayon() { + return CanUpgradeRayon && getUpgradeRayon() < 3; + } + + public boolean isUpgradableNrj() { + return CanUpgradeNrj && getUpgradeNrj() < 3; + } + + public int getUpgradeTemp() { + return Math.abs((int) ((10 * UpgradedTemp - 10) / 2f)); + } + + public int getUpgradeCycle() { + return Math.abs((int) ((10 * UpgradedCycle - 10) / 2f)); + } + + public int getUpgradeRayon() { + return Math.abs((int) ((10 * UpgradedRayon - 10) / 2f)); + } + + public int getUpgradeNrj() { + return Math.abs((int) ((10 * UpgradedNrj - 10) / 2f)); + } + + public float getUsedTemp() { + return UsedTemp * UpgradedTemp; + } + + public float getUsedRayon() { + return UsedRayon * UpgradedRayon; + } + + public float getUsedNrj() { + return UsedNrj * UpgradedNrj; + } + + public float getTurnTemp() { + return TurnTemp * UpgradedTemp; + } + + public float getTurnRayon() { + return TurnRayon * UpgradedRayon; + } + + public float getTurnNrj() { + return TurnNrj * UpgradedNrj; + } + + public Transmuter getUpgrade() { + return this.Upgrade; + } + + public Array getUnlock() { + return this.Unlock; + } + +} diff --git a/core/src/fr/evolving/screens/LevelScreen.java b/core/src/fr/evolving/screens/LevelScreen.java index c710297..6406d87 100644 --- a/core/src/fr/evolving/screens/LevelScreen.java +++ b/core/src/fr/evolving/screens/LevelScreen.java @@ -82,6 +82,7 @@ public class LevelScreen implements Screen { private ButtonGroup