mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00: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;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -91,18 +93,36 @@ class KinTreeInvocationCreateTokenEffect extends OneShotEffect {
|
|||
value = permanent.getToughness().getValue();
|
||||
}
|
||||
}
|
||||
|
||||
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 token = new SpiritWarriorToken(value);
|
||||
token.getAbilities().newId(); // neccessary if token has ability like DevourAbility()
|
||||
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||
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;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -105,17 +107,33 @@ class OozeGardenCreateTokenEffect extends OneShotEffect {
|
|||
value = ((SacrificeTargetCost)cost).getPermanents().get(0).getPower().getValue();
|
||||
}
|
||||
}
|
||||
SubTypeList list = new SubTypeList();
|
||||
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 token = new OozeToken(value);
|
||||
token.getAbilities().newId(); // neccessary if token has ability like DevourAbility()
|
||||
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
||||
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…
Reference in a new issue