From 99e3e04ab65d3e07a76b8fe8209b6e3265f74085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Hord=C3=A9?= Date: Mon, 18 Jan 2016 00:33:06 +0100 Subject: [PATCH] feat: ajout des transmuteurs de la classe directions. --- core/src/fr/evolving/assets/AssetLoader.java | 11 + .../src/fr/evolving/automata/Insufler100.java | 293 +++++++++++++++++ core/src/fr/evolving/automata/Insufler33.java | 295 ++++++++++++++++++ core/src/fr/evolving/automata/Insufler50.java | 295 ++++++++++++++++++ core/src/fr/evolving/automata/Oneway.java | 277 ++++++++++++++++ .../src/fr/evolving/automata/distributor.java | 285 +++++++++++++++++ core/src/fr/evolving/screens/GameScreen.java | 9 +- 7 files changed, 1462 insertions(+), 3 deletions(-) create mode 100644 core/src/fr/evolving/automata/Insufler100.java create mode 100644 core/src/fr/evolving/automata/Insufler33.java create mode 100644 core/src/fr/evolving/automata/Insufler50.java create mode 100644 core/src/fr/evolving/automata/Oneway.java create mode 100644 core/src/fr/evolving/automata/distributor.java diff --git a/core/src/fr/evolving/assets/AssetLoader.java b/core/src/fr/evolving/assets/AssetLoader.java index dbfd784..912bb89 100644 --- a/core/src/fr/evolving/assets/AssetLoader.java +++ b/core/src/fr/evolving/assets/AssetLoader.java @@ -28,6 +28,10 @@ import com.badlogic.gdx.utils.viewport.FitViewport; import com.badlogic.gdx.utils.viewport.ScalingViewport; import com.badlogic.gdx.utils.viewport.StretchViewport; import com.badlogic.gdx.Application; + +import fr.evolving.automata.Insufler100; +import fr.evolving.automata.Insufler33; +import fr.evolving.automata.Insufler50; import fr.evolving.automata.Inverter_I; import fr.evolving.automata.Inverter_II; import fr.evolving.automata.Negativer; @@ -36,11 +40,13 @@ import fr.evolving.automata.Negativer_II; import fr.evolving.automata.Negativer_III; import fr.evolving.automata.Neutraliser_I; import fr.evolving.automata.Neutraliser_II; +import fr.evolving.automata.Oneway; import fr.evolving.automata.Positiver; import fr.evolving.automata.Positiver_I; import fr.evolving.automata.Positiver_II; import fr.evolving.automata.Positiver_III; import fr.evolving.automata.Transmuter; +import fr.evolving.automata.distributor; import fr.evolving.database.Base.datatype; import fr.evolving.database.DatabaseManager; import fr.evolving.database.LocalBase; @@ -192,6 +198,11 @@ public class AssetLoader { allTransmuter.add(new Inverter_II(null)); allTransmuter.add(new Neutraliser_I(null)); allTransmuter.add(new Neutraliser_II(null)); + allTransmuter.add(new Oneway(null)); + allTransmuter.add(new distributor(null)); + allTransmuter.add(new Insufler100(null)); + allTransmuter.add(new Insufler33(null)); + allTransmuter.add(new Insufler50(null)); for (Transmuter transmuter : allTransmuter) { Values allTiles = transmuter.getTilesid().iterator(); while (allTiles.hasNext()) { diff --git a/core/src/fr/evolving/automata/Insufler100.java b/core/src/fr/evolving/automata/Insufler100.java new file mode 100644 index 0000000..f5f8f05 --- /dev/null +++ b/core/src/fr/evolving/automata/Insufler100.java @@ -0,0 +1,293 @@ +package fr.evolving.automata; + +import java.util.Iterator; + +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.ObjectMap.Values; +import com.badlogic.gdx.utils.OrderedMap; + +public class Insufler100 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 Transmuter 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 int ActivationLevel; + private int Rotation; + private static OrderedMap Tilestype; + private static OrderedMap Tilesid; + + public Insufler100(Level level) { + super(level); + this.Name = "Insufleur 100%"; + this.Desc = "Insufleur blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec"; + this.theClass = Class.Charge; + this.Price = 50; + this.Technology = 2; + this.Research = 0; + this.Upgrade = new Positiver_II(level); + 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.5f; + 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, 1), CaseType.Cuivre); + this.Tilestype.put(new Vector2(0, 1), CaseType.Cuivre); + this.Tilestype.put(new Vector2(1, 1), CaseType.Rien); + this.Tilestype.put(new Vector2(-1, 0), CaseType.Rien); + this.Tilestype.put(new Vector2(0, 0), CaseType.Cuivre); + this.Tilestype.put(new Vector2(1, 0), CaseType.Cuivre); + this.Tilestype.put(new Vector2(-1, -1), CaseType.Cuivre); + this.Tilestype.put(new Vector2(0, -1), CaseType.Cuivre); + this.Tilestype.put(new Vector2(1, -1), CaseType.Rien); + this.Tilesid = new OrderedMap(); + this.Tilesid.put(new Vector2(-1, 1), 120); + this.Tilesid.put(new Vector2(0,1), 121); + this.Tilesid.put(new Vector2(1, 1), 122); + this.Tilesid.put(new Vector2(-1, 0), 123); + this.Tilesid.put(new Vector2(0, 0), 124); + this.Tilesid.put(new Vector2(1, 0), 125); + this.Tilesid.put(new Vector2(-1, -1), 126); + this.Tilesid.put(new Vector2(0, -1), 127); + this.Tilesid.put(new Vector2(1, -1), 128); + } + + public String getName() { + return this.Name; + } + + public String getDesc() { + return this.Desc; + } + + public String getaClass() { + return this.theClass.toString(); + } + + 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 Unlock() { + if (this.Unlock == null) + return; + this.Unlock.SetShowed(true); + } + + public void Upgrade() { + if (this.Upgrade == null) + return; + this.Unlock.SetShowed(true); + this.SetShowed(false); + } + + 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 isUpgradable() { + return this.Upgrade != null && this.Upgrade.isShowed(); + } + + public boolean isUnlockable() { + return this.Unlock != null && this.Unlock.isShowed(); + } + + 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 Transmuter getUnlock() { + return this.Unlock; + } + +} diff --git a/core/src/fr/evolving/automata/Insufler33.java b/core/src/fr/evolving/automata/Insufler33.java new file mode 100644 index 0000000..1dc55ed --- /dev/null +++ b/core/src/fr/evolving/automata/Insufler33.java @@ -0,0 +1,295 @@ +package fr.evolving.automata; + +import java.util.Iterator; + +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.ObjectMap.Values; +import com.badlogic.gdx.utils.OrderedMap; + +import fr.evolving.automata.Transmuter.CaseType; + +public class Insufler33 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 Transmuter 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 int ActivationLevel; + private int Rotation; + private static OrderedMap Tilestype; + private static OrderedMap Tilesid; + + public Insufler33(Level level) { + super(level); + this.Name = "Insufleur 33%"; + this.Desc = "Insufleur 33% avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec"; + this.theClass = Class.Charge; + this.Price = 50; + this.Technology = 2; + this.Research = 0; + this.Upgrade = new Positiver_II(level); + 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.5f; + 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, 1), CaseType.Cuivre); + this.Tilestype.put(new Vector2(0, 1), CaseType.Cuivre); + this.Tilestype.put(new Vector2(1, 1), CaseType.Rien); + this.Tilestype.put(new Vector2(-1, 0), CaseType.Rien); + this.Tilestype.put(new Vector2(0, 0), CaseType.Cuivre); + this.Tilestype.put(new Vector2(1, 0), CaseType.Cuivre); + this.Tilestype.put(new Vector2(-1, -1), CaseType.Cuivre); + this.Tilestype.put(new Vector2(0, -1), CaseType.Cuivre); + this.Tilestype.put(new Vector2(1, -1), CaseType.Rien); + this.Tilesid = new OrderedMap(); + this.Tilesid.put(new Vector2(-1, 1), 120); + this.Tilesid.put(new Vector2(0,1), 121); + this.Tilesid.put(new Vector2(1, 1), 122); + this.Tilesid.put(new Vector2(-1, 0), 123); + this.Tilesid.put(new Vector2(0, 0), 129); + this.Tilesid.put(new Vector2(1, 0), 125); + this.Tilesid.put(new Vector2(-1, -1), 126); + this.Tilesid.put(new Vector2(0, -1), 127); + this.Tilesid.put(new Vector2(1, -1), 128); + } + + public String getName() { + return this.Name; + } + + public String getDesc() { + return this.Desc; + } + + public String getaClass() { + return this.theClass.toString(); + } + + 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 Unlock() { + if (this.Unlock == null) + return; + this.Unlock.SetShowed(true); + } + + public void Upgrade() { + if (this.Upgrade == null) + return; + this.Unlock.SetShowed(true); + this.SetShowed(false); + } + + 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 isUpgradable() { + return this.Upgrade != null && this.Upgrade.isShowed(); + } + + public boolean isUnlockable() { + return this.Unlock != null && this.Unlock.isShowed(); + } + + 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 Transmuter getUnlock() { + return this.Unlock; + } + +} diff --git a/core/src/fr/evolving/automata/Insufler50.java b/core/src/fr/evolving/automata/Insufler50.java new file mode 100644 index 0000000..d82ed80 --- /dev/null +++ b/core/src/fr/evolving/automata/Insufler50.java @@ -0,0 +1,295 @@ +package fr.evolving.automata; + +import java.util.Iterator; + +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.ObjectMap.Values; +import com.badlogic.gdx.utils.OrderedMap; + +import fr.evolving.automata.Transmuter.CaseType; + +public class Insufler50 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 Transmuter 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 int ActivationLevel; + private int Rotation; + private static OrderedMap Tilestype; + private static OrderedMap Tilesid; + + public Insufler50(Level level) { + super(level); + this.Name = "Insufleur 50%"; + this.Desc = "Insufleur 50% avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec"; + this.theClass = Class.Charge; + this.Price = 50; + this.Technology = 2; + this.Research = 0; + this.Upgrade = new Positiver_II(level); + 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.5f; + 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, 1), CaseType.Cuivre); + this.Tilestype.put(new Vector2(0, 1), CaseType.Cuivre); + this.Tilestype.put(new Vector2(1, 1), CaseType.Rien); + this.Tilestype.put(new Vector2(-1, 0), CaseType.Rien); + this.Tilestype.put(new Vector2(0, 0), CaseType.Cuivre); + this.Tilestype.put(new Vector2(1, 0), CaseType.Cuivre); + this.Tilestype.put(new Vector2(-1, -1), CaseType.Cuivre); + this.Tilestype.put(new Vector2(0, -1), CaseType.Cuivre); + this.Tilestype.put(new Vector2(1, -1), CaseType.Rien); + this.Tilesid = new OrderedMap(); + this.Tilesid.put(new Vector2(-1, 1), 120); + this.Tilesid.put(new Vector2(0,1), 121); + this.Tilesid.put(new Vector2(1, 1), 122); + this.Tilesid.put(new Vector2(-1, 0), 123); + this.Tilesid.put(new Vector2(0, 0), 130); + this.Tilesid.put(new Vector2(1, 0), 125); + this.Tilesid.put(new Vector2(-1, -1), 126); + this.Tilesid.put(new Vector2(0, -1), 127); + this.Tilesid.put(new Vector2(1, -1), 128); + } + + public String getName() { + return this.Name; + } + + public String getDesc() { + return this.Desc; + } + + public String getaClass() { + return this.theClass.toString(); + } + + 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 Unlock() { + if (this.Unlock == null) + return; + this.Unlock.SetShowed(true); + } + + public void Upgrade() { + if (this.Upgrade == null) + return; + this.Unlock.SetShowed(true); + this.SetShowed(false); + } + + 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 isUpgradable() { + return this.Upgrade != null && this.Upgrade.isShowed(); + } + + public boolean isUnlockable() { + return this.Unlock != null && this.Unlock.isShowed(); + } + + 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 Transmuter getUnlock() { + return this.Unlock; + } + +} diff --git a/core/src/fr/evolving/automata/Oneway.java b/core/src/fr/evolving/automata/Oneway.java new file mode 100644 index 0000000..74b3b82 --- /dev/null +++ b/core/src/fr/evolving/automata/Oneway.java @@ -0,0 +1,277 @@ +package fr.evolving.automata; + +import java.util.Iterator; + +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.ObjectMap.Values; +import com.badlogic.gdx.utils.OrderedMap; + +public class Oneway 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 Transmuter 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 int ActivationLevel; + private int Rotation; + private static OrderedMap Tilestype; + private static OrderedMap Tilesid; + + public Oneway(Level level) { + super(level); + this.Name = "Antiretour"; + this.Desc = "Antiretour avec...blabla avec...blabla avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec"; + this.theClass = Class.Charge; + this.Price = 50; + this.Technology = 2; + this.Research = 0; + this.Upgrade = new Positiver_II(level); + 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.5f; + 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(0, 0), CaseType.Cuivre); + this.Tilesid = new OrderedMap(); + this.Tilesid.put(new Vector2(0, 0), 114); + } + + public String getName() { + return this.Name; + } + + public String getDesc() { + return this.Desc; + } + + public String getaClass() { + return this.theClass.toString(); + } + + 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 Unlock() { + if (this.Unlock == null) + return; + this.Unlock.SetShowed(true); + } + + public void Upgrade() { + if (this.Upgrade == null) + return; + this.Unlock.SetShowed(true); + this.SetShowed(false); + } + + 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 isUpgradable() { + return this.Upgrade != null && this.Upgrade.isShowed(); + } + + public boolean isUnlockable() { + return this.Unlock != null && this.Unlock.isShowed(); + } + + 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 Transmuter getUnlock() { + return this.Unlock; + } + +} diff --git a/core/src/fr/evolving/automata/distributor.java b/core/src/fr/evolving/automata/distributor.java new file mode 100644 index 0000000..412396f --- /dev/null +++ b/core/src/fr/evolving/automata/distributor.java @@ -0,0 +1,285 @@ +package fr.evolving.automata; + +import java.util.Iterator; + +import com.badlogic.gdx.math.Vector2; +import com.badlogic.gdx.utils.ObjectMap.Values; +import com.badlogic.gdx.utils.OrderedMap; + +public class distributor 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 Transmuter 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 int ActivationLevel; + private int Rotation; + private static OrderedMap Tilestype; + private static OrderedMap Tilesid; + + public distributor(Level level) { + super(level); + this.Name = "Distributeur"; + this.Desc = "Distribue lol avec avecave aveca vecavec avec avec avec avecavecavecavec avec avecavecavec avec avecavecavecavec avec"; + this.theClass = Class.Direction; + this.Price = 50; + this.Technology = 2; + 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.5f; + 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(0, 1), CaseType.Cuivre); + this.Tilestype.put(new Vector2(-1, 0), CaseType.Cuivre); + this.Tilestype.put(new Vector2(0, 0), CaseType.Tout); + this.Tilestype.put(new Vector2(1, 0), CaseType.Cuivre); + this.Tilestype.put(new Vector2(0, -1), CaseType.Cuivre); + this.Tilesid = new OrderedMap(); + this.Tilesid.put(new Vector2(0, 1), 115); + this.Tilesid.put(new Vector2(-1, 0), 116); + this.Tilesid.put(new Vector2(0, 0), 117); + this.Tilesid.put(new Vector2(1, 0), 118); + this.Tilesid.put(new Vector2(0, -1), 119); + } + + public String getName() { + return this.Name; + } + + public String getDesc() { + return this.Desc; + } + + public String getaClass() { + return this.theClass.toString(); + } + + 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 Unlock() { + if (this.Unlock == null) + return; + this.Unlock.SetShowed(true); + } + + public void Upgrade() { + if (this.Upgrade == null) + return; + this.Unlock.SetShowed(true); + this.SetShowed(false); + } + + 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 isUpgradable() { + return this.Upgrade != null && this.Upgrade.isShowed(); + } + + public boolean isUnlockable() { + return this.Unlock != null && this.Unlock.isShowed(); + } + + 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 Transmuter getUnlock() { + return this.Unlock; + } + +} diff --git a/core/src/fr/evolving/screens/GameScreen.java b/core/src/fr/evolving/screens/GameScreen.java index dabf2e3..f4d75fc 100644 --- a/core/src/fr/evolving/screens/GameScreen.java +++ b/core/src/fr/evolving/screens/GameScreen.java @@ -56,6 +56,7 @@ import fr.evolving.UI.WarnDialog; import fr.evolving.assets.AssetLoader; import fr.evolving.assets.Preference; import fr.evolving.automata.Level; +import fr.evolving.automata.Neutraliser_II; import fr.evolving.automata.Transmuter; import fr.evolving.automata.Transmuter.Angular; import fr.evolving.automata.Transmuter.CaseType; @@ -966,11 +967,13 @@ public class GameScreen implements Screen { menu.setMenuTransmuter(0, 3, "Neutraliseur I", Angular.A00); menu.setMenuTransmuter(1, 3, "Neutraliseur II", Angular.A00); } else if (menuitem == 2) { - + menu.setMenuTransmuter(0, 7, "Antiretour", Angular.A00); + menu.setMenuTransmuter(1, 6, "Distributeur", Angular.A00); + menu.setMenuTransmuter(1, 2, "Insufleur 33%", Angular.A00); } else if (menuitem == 3) { - + menu.setMenuTransmuter(1, 2, "Insufleur 50%", Angular.A00); } else if (menuitem == 4) { - + menu.setMenuTransmuter(1, 2, "Insufleur 100%", Angular.A00); } else if (menuitem == 5) { } else if (menuitem == 6) {