* Reworked non mana costs with variable amount. The values have now to be announced before targeting. Fixed some wrong implementations (Firestorm, Myr Battlesphere, Skeletal Scrying).

This commit is contained in:
LevelX2 2014-03-09 19:47:31 +01:00
parent 2d9f260b1e
commit 7ebb8a9cbe
46 changed files with 1176 additions and 1187 deletions

View file

@ -53,27 +53,31 @@ public class Counters extends HashMap<String, Counter> implements Serializable {
}
public void addCounter(String name) {
if (!this.containsKey(name))
if (!this.containsKey(name)) {
this.put(name, new Counter(name));
}
this.get(name).add();
}
public void addCounter(String name, int amount) {
if (!this.containsKey(name))
if (!this.containsKey(name)) {
this.put(name, new Counter(name));
}
this.get(name).add(amount);
}
public void addCounter(Counter counter) {
if (!this.containsKey(counter.name))
if (!this.containsKey(counter.name)) {
put(counter.name, counter);
else
} else {
get(counter.name).add(counter.getCount());
}
}
public void removeCounter(String name) {
if (this.containsKey(name))
if (this.containsKey(name)) {
this.get(name).remove();
}
}
public void removeCounter(CounterType counterType, int amount) {
@ -83,13 +87,15 @@ public class Counters extends HashMap<String, Counter> implements Serializable {
}
public void removeCounter(String name, int amount) {
if (this.containsKey(name))
if (this.containsKey(name)) {
this.get(name).remove(amount);
}
}
public int getCount(String name) {
if (this.containsKey(name))
if (this.containsKey(name)) {
return this.get(name).getCount();
}
return 0;
}
@ -98,16 +104,18 @@ public class Counters extends HashMap<String, Counter> implements Serializable {
}
public int getCount(CounterType type) {
if (this.containsKey(type.getName()))
if (this.containsKey(type.getName())) {
return this.get(type.getName()).getCount();
}
return 0;
}
public List<BoostCounter> getBoostCounters() {
List<BoostCounter> boosters = new ArrayList<BoostCounter>();
List<BoostCounter> boosters = new ArrayList<>();
for (Counter counter: this.values()) {
if (counter instanceof BoostCounter)
if (counter instanceof BoostCounter) {
boosters.add((BoostCounter)counter);
}
}
return boosters;
}