diff --git a/core/src/fr/evolving/UI/Menu.java b/core/src/fr/evolving/UI/Menu.java index 06c992f..84a7ec6 100644 --- a/core/src/fr/evolving/UI/Menu.java +++ b/core/src/fr/evolving/UI/Menu.java @@ -271,6 +271,11 @@ public class Menu extends Actor { this.setMenuTransmuter(1, 6, "=-",Angular.A90,0); this.setMenuTransmuter(2, 6, "=!",Angular.A90,0); this.setMenuTransmuter(3, 6, "=E",Angular.A90,0); + this.setMenuTransmuter(1, 4, "=1",Angular.A00,0); + this.setMenuTransmuter(1, 3, "=2",Angular.A00,0); + this.setMenuTransmuter(1, 2, "=4",Angular.A00,0); + this.setMenuTransmuter(1, 7, "=4a",Angular.A00,1); + this.setMenuTransmuter(1, 6, "=8a",Angular.A00,1); this.unSelect(); } diff --git a/core/src/fr/evolving/assets/AssetLoader.java b/core/src/fr/evolving/assets/AssetLoader.java index 58e7bb1..407bf83 100644 --- a/core/src/fr/evolving/assets/AssetLoader.java +++ b/core/src/fr/evolving/assets/AssetLoader.java @@ -29,6 +29,11 @@ import com.badlogic.gdx.utils.viewport.ScalingViewport; import com.badlogic.gdx.utils.viewport.StretchViewport; import com.badlogic.gdx.Application; +import fr.evolving.automata.Filter1; +import fr.evolving.automata.Filter2; +import fr.evolving.automata.Filter4; +import fr.evolving.automata.Filter4Activable; +import fr.evolving.automata.Filter8Activable; import fr.evolving.automata.FilterActivable; import fr.evolving.automata.FilterBig; import fr.evolving.automata.FilterNegative; @@ -207,6 +212,11 @@ public class AssetLoader { allTransmuter.add(new FilterNegative(null)); allTransmuter.add(new FilterBig(null)); allTransmuter.add(new FilterActivable(null)); + allTransmuter.add(new Filter1(null)); + allTransmuter.add(new Filter2(null)); + allTransmuter.add(new Filter4(null)); + allTransmuter.add(new Filter4Activable(null)); + allTransmuter.add(new Filter8Activable(null)); for (Transmuter transmuter : allTransmuter) { Values allTiles = transmuter.getTilesid().iterator(); while (allTiles.hasNext()) { diff --git a/core/src/fr/evolving/automata/Filter1.java b/core/src/fr/evolving/automata/Filter1.java new file mode 100644 index 0000000..9b8362c --- /dev/null +++ b/core/src/fr/evolving/automata/Filter1.java @@ -0,0 +1,285 @@ +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 Filter1 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 Filter1(Level level) { + super(level); + this.id="=1"; + this.Name = AssetLoader.language.get("[filter1-name]"); + this.Desc = AssetLoader.language.get("[filter1-desc]"); + this.theClass = Class.Filtrage; + this.Price = 250; + this.Technology = 8; + this.Research = 0; + this.Upgrade = null; + this.Unlock = new Array(); + this.Unlock.add(new Filter2(level)); + this.Unlock.add(new Filter4(level)); + 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), 160); + this.Tilesid.put(new Vector2(-1, 0), 159); + this.Tilesid.put(new Vector2(0, 0), 155); + } + + 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/Filter2.java b/core/src/fr/evolving/automata/Filter2.java new file mode 100644 index 0000000..8e2b21e --- /dev/null +++ b/core/src/fr/evolving/automata/Filter2.java @@ -0,0 +1,284 @@ +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 Filter2 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 Filter2(Level level) { + super(level); + this.id="=2"; + this.Name = AssetLoader.language.get("[filter2-name]"); + this.Desc = AssetLoader.language.get("[filter2-desc]"); + this.theClass = Class.Filtrage; + this.Price = 275; + this.Technology = 8; + this.Research = 150; + this.Upgrade = null; + this.Unlock = new Array(); + this.Unlock.add(new Filter4(level)); + this.showed = false; + 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), 162); + this.Tilesid.put(new Vector2(-1, 0), 161); + this.Tilesid.put(new Vector2(0, 0), 156); + } + + 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/Filter4.java b/core/src/fr/evolving/automata/Filter4.java new file mode 100644 index 0000000..30acee7 --- /dev/null +++ b/core/src/fr/evolving/automata/Filter4.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 Filter4 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 Filter4(Level level) { + super(level); + this.id="=4"; + this.Name = AssetLoader.language.get("[filter4-name]"); + this.Desc = AssetLoader.language.get("[filter4-desc]"); + this.theClass = Class.Filtrage; + this.Price = 300; + this.Technology = 8; + this.Research = 300; + this.Upgrade = null; + this.Unlock = null; + this.showed = false; + 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), 164); + this.Tilesid.put(new Vector2(-1, 0), 163); + this.Tilesid.put(new Vector2(0, 0), 158); + } + + 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/Filter4Activable.java b/core/src/fr/evolving/automata/Filter4Activable.java new file mode 100644 index 0000000..2109b1a --- /dev/null +++ b/core/src/fr/evolving/automata/Filter4Activable.java @@ -0,0 +1,284 @@ +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 Filter4Activable 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 Filter4Activable(Level level) { + super(level); + this.id="=4a"; + this.Name = AssetLoader.language.get("[filter4activable-name]"); + this.Desc = AssetLoader.language.get("[filter4activable-desc]"); + this.theClass = Class.Filtrage; + this.Price = 350; + this.Technology = 9; + this.Research = 0; + this.Upgrade = null; + this.Unlock = new Array(); + this.Unlock.add(new Filter8Activable(level)); + 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 = true; + 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), 164); + this.Tilesid.put(new Vector2(-1, 0), 163); + this.Tilesid.put(new Vector2(0, 0), 171); + } + + 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/Filter8Activable.java b/core/src/fr/evolving/automata/Filter8Activable.java new file mode 100644 index 0000000..02ae9ee --- /dev/null +++ b/core/src/fr/evolving/automata/Filter8Activable.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 Filter8Activable 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 Filter8Activable(Level level) { + super(level); + this.id="=8a"; + this.Name = AssetLoader.language.get("[filter8activable-name]"); + this.Desc = AssetLoader.language.get("[filter8activable-desc]"); + this.theClass = Class.Filtrage; + this.Price = 375; + this.Technology = 9; + this.Research = 500; + this.Upgrade = null; + this.Unlock = null; + this.showed = false; + 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 = true; + 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), 166); + this.Tilesid.put(new Vector2(-1, 0), 165); + this.Tilesid.put(new Vector2(0, 0), 175); + } + + 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/Insufler33.java b/core/src/fr/evolving/automata/Insufler33.java index d8b5738..5808fea 100644 --- a/core/src/fr/evolving/automata/Insufler33.java +++ b/core/src/fr/evolving/automata/Insufler33.java @@ -50,6 +50,7 @@ public class Insufler33 extends Transmuter { this.Research = 0; this.Upgrade = null; this.Unlock = new Array(); + this.Unlock.add(new Insufler100(null)); this.Unlock.add(new Insufler50(null)); this.showed = true; this.CanUpgradeTemp = true; diff --git a/core/src/fr/evolving/automata/Worlds.java b/core/src/fr/evolving/automata/Worlds.java index 5a990c0..1cf29be 100644 --- a/core/src/fr/evolving/automata/Worlds.java +++ b/core/src/fr/evolving/automata/Worlds.java @@ -503,6 +503,7 @@ public class Worlds extends Actor { public int getMaxWorlds() { int max = 0; + if (levels!=null) for (Level level : levels) if (level != null && level.aWorld > max) max = level.aWorld; @@ -530,6 +531,7 @@ public class Worlds extends Actor { public int getMaxLevel(int world) { int max = 0; + if (levels!=null) for (Level level : levels) if (level != null && level.aWorld == world && level.aLevel>max) max = level.aLevel; diff --git a/core/src/fr/evolving/screens/LevelScreen.java b/core/src/fr/evolving/screens/LevelScreen.java index f343b60..d3ee734 100644 --- a/core/src/fr/evolving/screens/LevelScreen.java +++ b/core/src/fr/evolving/screens/LevelScreen.java @@ -328,7 +328,11 @@ public class LevelScreen implements Screen { else selectnoone(); if (worlds.getLevelData()==null) - selected=buttonLevels.first(); + if (buttonLevels.size>0) + selectone(); + else + selectnoone(); + Previous.setVisible(!worlds.isFirstWorld()); if (worlds.isDebug()) Next.setVisible(!worlds.isRealLastWorld()); @@ -951,6 +955,7 @@ public class LevelScreen implements Screen { creater.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { + if (worlds.isDebug() && addbutton.isChecked()) { Level level=new Level( worlds.getWorld(), worlds.getFreeLevel(), @@ -962,6 +967,7 @@ public class LevelScreen implements Screen { 99999, 99999, "", false, new int[][] {{}}); worlds.addLevel(level); } + } }); temp_orig = new ImageTextButton("", AssetLoader.Skin_level, "temp"); temp_orig.setPosition(1665, 360);