mirror of
https://github.com/correl/mage.git
synced 2025-03-16 01:06:34 -09:00
replaced concrete usages of Token with new subclasses of abstract Token class
This commit is contained in:
parent
03eb170a04
commit
a68cac5a2b
2 changed files with 55 additions and 17 deletions
|
@ -28,6 +28,8 @@
|
||||||
package mage.cards.k;
|
package mage.cards.k;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.AbilitiesImpl;
|
import mage.abilities.AbilitiesImpl;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -91,18 +93,36 @@ class KinTreeInvocationCreateTokenEffect extends OneShotEffect {
|
||||||
value = permanent.getToughness().getValue();
|
value = permanent.getToughness().getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Token token = new SpiritWarriorToken(value);
|
||||||
SubTypeList list = new SubTypeList();
|
|
||||||
list.add(SubType.SPIRIT);
|
|
||||||
list.add(SubType.WARRIOR);
|
|
||||||
ObjectColor objectColor = new ObjectColor();
|
|
||||||
objectColor.setBlack(true);
|
|
||||||
objectColor.setGreen(true);
|
|
||||||
Token token = new Token("Spirit Warrior", "X/X black and green Spirit Warrior creature token, where X is the greatest toughness among creatures you control",
|
|
||||||
objectColor, list, value, value, new AbilitiesImpl<>());
|
|
||||||
token.getAbilities().newId(); // neccessary if token has ability like DevourAbility()
|
token.getAbilities().newId(); // neccessary if token has ability like DevourAbility()
|
||||||
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SpiritWarriorToken extends Token {
|
||||||
|
|
||||||
|
public SpiritWarriorToken() {
|
||||||
|
this(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpiritWarriorToken(int x) {
|
||||||
|
super("Spirit Warrior", "X/X black and green Spirit Warrior creature token, where X is the greatest toughness among creatures you control");
|
||||||
|
this.subtype.add(SubType.SPIRIT);
|
||||||
|
this.subtype.add(SubType.WARRIOR);
|
||||||
|
ObjectColor objectColor = new ObjectColor();
|
||||||
|
objectColor.setBlack(true);
|
||||||
|
objectColor.setGreen(true);
|
||||||
|
this.power = new MageInt(x);
|
||||||
|
this.toughness = new MageInt(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpiritWarriorToken(final SpiritWarriorToken token) {
|
||||||
|
super(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpiritWarriorToken copy() {
|
||||||
|
return new SpiritWarriorToken(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
package mage.cards.o;
|
package mage.cards.o;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.AbilitiesImpl;
|
import mage.abilities.AbilitiesImpl;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -105,17 +107,33 @@ class OozeGardenCreateTokenEffect extends OneShotEffect {
|
||||||
value = ((SacrificeTargetCost)cost).getPermanents().get(0).getPower().getValue();
|
value = ((SacrificeTargetCost)cost).getPermanents().get(0).getPower().getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SubTypeList list = new SubTypeList();
|
Token token = new OozeToken(value);
|
||||||
list.add(SubType.OOZE);
|
|
||||||
Token token = new Token("Ooze", "X/X green Ooze creature token, where X is the sacrificed creature's power", ObjectColor.GREEN, list, value, value, new AbilitiesImpl<>()) {
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
token.getAbilities().newId(); // neccessary if token has ability like DevourAbility()
|
token.getAbilities().newId(); // neccessary if token has ability like DevourAbility()
|
||||||
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class OozeToken extends Token {
|
||||||
|
|
||||||
|
public OozeToken() {
|
||||||
|
this(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OozeToken(int x) {
|
||||||
|
super("Ooze", "X/X green Ooze creature token, where X is the sacrificed creature's power");
|
||||||
|
this.color.addColor(ObjectColor.GREEN);
|
||||||
|
this.subtype.add(SubType.OOZE);
|
||||||
|
|
||||||
|
this.toughness = new MageInt(x);
|
||||||
|
this.power = new MageInt(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OozeToken(final OozeToken token) {
|
||||||
|
super(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OozeToken copy() {
|
||||||
|
return new OozeToken(this);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue