feat: ajout de 4 transmuteurs et avancement sur les liens intermondes

This commit is contained in:
Nicolas Hordé 2016-07-10 12:16:08 +02:00
parent 9cdfefee80
commit 5d60c7edbc
7 changed files with 1156 additions and 19 deletions

View File

@ -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();
}

View File

@ -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<Integer> allTiles = transmuter.getTilesid().iterator();
while (allTiles.hasNext()) {

View File

@ -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<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 transient int ActivationLevel;
private static String id;
private static OrderedMap<Vector2, CaseType> Tilestype;
private static OrderedMap<Vector2, Integer> 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<Vector2, CaseType>();
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<Vector2, Integer>();
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<Integer> getTilesid() {
return Tilesid.values();
}
public CaseType getTilestype(int order) {
return Tilestype.values().toArray().get(order);
}
public OrderedMap<Vector2, Integer> getTilesidrotated() {
OrderedMap<Vector2, Integer> newTiles = new OrderedMap<Vector2, Integer>();
Iterator<Vector2> 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<Transmuter> getUnlock() {
return this.Unlock;
}
}

View File

@ -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<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 transient int ActivationLevel;
private static String id;
private static OrderedMap<Vector2, CaseType> Tilestype;
private static OrderedMap<Vector2, Integer> 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<Vector2, CaseType>();
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<Vector2, Integer>();
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<Integer> getTilesid() {
return Tilesid.values();
}
public CaseType getTilestype(int order) {
return Tilestype.values().toArray().get(order);
}
public OrderedMap<Vector2, Integer> getTilesidrotated() {
OrderedMap<Vector2, Integer> newTiles = new OrderedMap<Vector2, Integer>();
Iterator<Vector2> 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<Transmuter> getUnlock() {
return this.Unlock;
}
}

View File

@ -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<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 transient int ActivationLevel;
private static String id;
private static OrderedMap<Vector2, CaseType> Tilestype;
private static OrderedMap<Vector2, Integer> 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<Vector2, CaseType>();
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<Vector2, Integer>();
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<Integer> getTilesid() {
return Tilesid.values();
}
public CaseType getTilestype(int order) {
return Tilestype.values().toArray().get(order);
}
public OrderedMap<Vector2, Integer> getTilesidrotated() {
OrderedMap<Vector2, Integer> newTiles = new OrderedMap<Vector2, Integer>();
Iterator<Vector2> 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<Transmuter> getUnlock() {
return this.Unlock;
}
}

View File

@ -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<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 transient int ActivationLevel;
private static String id;
private static OrderedMap<Vector2, CaseType> Tilestype;
private static OrderedMap<Vector2, Integer> 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<Vector2, CaseType>();
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<Vector2, Integer>();
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<Integer> getTilesid() {
return Tilesid.values();
}
public CaseType getTilestype(int order) {
return Tilestype.values().toArray().get(order);
}
public OrderedMap<Vector2, Integer> getTilesidrotated() {
OrderedMap<Vector2, Integer> newTiles = new OrderedMap<Vector2, Integer>();
Iterator<Vector2> 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<Transmuter> getUnlock() {
return this.Unlock;
}
}

View File

@ -82,6 +82,7 @@ public class LevelScreen implements Screen {
private ButtonGroup<Button> chooser, modifbar;
public Group group_init, group_stat, group_level, group_base, group_debug, group_choose, group_other;
private DragAndDrop dragAndDrop;
public Source lastsource;
public void play() {
if (worlds.getState()!=State.notloaded && worlds.getState()!=State.databasefailed) {
@ -172,8 +173,6 @@ public class LevelScreen implements Screen {
if (buttonLevels!=null)
for(ButtonLevel buttonlevel:buttonLevels)
AddDragDrop((Actor)buttonlevel);
AddDragDrop((Actor)Previous);
AddDragDrop((Actor)Next);
}
public void AddDragDrop(final Actor actor) {
@ -182,26 +181,19 @@ public class LevelScreen implements Screen {
public Payload dragStart (InputEvent event, float x, float y, int pointer) {
Payload payload = new Payload();
payload.setObject(((ButtonLevel)event.getListenerActor()).level.clone());
payload.setDragActor(new Label("Choose destination", AssetLoader.Skin_ui));
Label validLabel = new Label("OK", AssetLoader.Skin_ui);
validLabel.setColor(0, 1, 0, 1);
payload.setValidDragActor(validLabel);
Label invalidLabel = new Label("NO", AssetLoader.Skin_ui);
invalidLabel.setColor(1, 0, 0, 1);
payload.setInvalidDragActor(invalidLabel);
return payload;
}
});
dragAndDrop.addTarget(new Target(actor) {
public boolean drag (Source source, Payload payload, float x, float y, int pointer) {
if (actor.getName()=="Previous" || actor.getName()=="Next"){
((ClickListener) actor.getListeners().peek()).clicked(null, 1980, 2002);
return false;
}
lastsource=source;
Level levelsrc=(Level)payload.getObject();
Level leveldst=((ButtonLevel)actor).level;
Gdx.app.debug("wirechem-LevelScreen", "Verification d'un lien du niveau "+levelsrc.aWorld+","+levelsrc.aLevel+" vers "+leveldst.aWorld+","+leveldst.aLevel);
@ -214,11 +206,9 @@ public class LevelScreen implements Screen {
return false;
}
}
public void reset (Source source, Payload payload) {
getActor().setColor(Color.WHITE);
}
public void drop (Source source, Payload payload, float x, float y, int pointer) {
Level levelsrc=(Level)payload.getObject();
Level leveldst=((ButtonLevel)actor).level;
@ -280,7 +270,6 @@ public class LevelScreen implements Screen {
buttonLevels.add(buttonlevel);
if (worlds.isDebug()) buttonlevel.setDisabled(false);
Gdx.app.debug("wirechem-LevelScreen", "Ajout du niveau :"+ level.Name + "" + String.valueOf(level.aLevel));
buttonlevel.addListener(buttonLevelslistener());
}
}
@ -514,9 +503,7 @@ public class LevelScreen implements Screen {
@Override
public void clicked(InputEvent event, float x, float y) {
worlds.NextWorld();
Gdx.app.debug("wirechem-LevelScreen",
"World:" + String.valueOf(worlds.getWorld()) + " Maxworld:"
+ String.valueOf(worlds.getMaxWorlds()));
Gdx.app.debug("wirechem-LevelScreen","World:" + String.valueOf(worlds.getWorld()) + " Maxworld:" + String.valueOf(worlds.getMaxWorlds()));
if (worlds.isDebug() && link.isChecked())
initDragDrop();
}
@ -528,9 +515,7 @@ public class LevelScreen implements Screen {
@Override
public void clicked(InputEvent event, float x, float y) {
worlds.PreviousWorld();
Gdx.app.debug("wirechem-LevelScreen",
"World:" + String.valueOf(worlds.getWorld()) + " Maxworld:"
+ String.valueOf(worlds.getMaxWorlds()));
Gdx.app.debug("wirechem-LevelScreen","World:" + String.valueOf(worlds.getWorld()) + " Maxworld:"+ String.valueOf(worlds.getMaxWorlds()));
if (worlds.isDebug() && link.isChecked())
initDragDrop();
}
@ -1103,6 +1088,15 @@ public class LevelScreen implements Screen {
signer = new ImageButton(AssetLoader.Skin_level, "add");
signer.setPosition(1660, 40);
signer.addListener(new ClickListener() {
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
worlds.PreviousWorld();
//initDragDrop();
//InputEvent eventer=new InputEvent();
//eventer.setType(InputEvent.Type.touchDragged);
//buttonLevels.first().fire(eventer);
//dragAndDrop.addSource(lastsource);
//lastsource.dragStart(eventer, x, y, pointer);
}
@Override
public void clicked(InputEvent event, float x, float y) {
String whereis=signer.getStyle().up.toString();