mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
[CMR] Implemented Yurlock of Scorch Thrash
This commit is contained in:
parent
5578437dde
commit
e387cf3c54
4 changed files with 153 additions and 1 deletions
138
Mage.Sets/src/mage/cards/y/YurlokOfScorchThrash.java
Normal file
138
Mage.Sets/src/mage/cards/y/YurlokOfScorchThrash.java
Normal file
|
@ -0,0 +1,138 @@
|
|||
package mage.cards.y;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.mana.ManaEffect;
|
||||
import mage.abilities.keyword.VigilanceAbility;
|
||||
import mage.abilities.mana.SimpleManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class YurlokOfScorchThrash extends CardImpl {
|
||||
|
||||
public YurlokOfScorchThrash(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{R}{G}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.VIASHINO);
|
||||
this.subtype.add(SubType.SHAMAN);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Vigilance
|
||||
this.addAbility(VigilanceAbility.getInstance());
|
||||
|
||||
// A player losing unspent mana causes that player to lose that much life.
|
||||
this.addAbility(new SimpleStaticAbility(new YurlokOfScorchThrashRuleEffect()));
|
||||
|
||||
// {1}, {T}: Each player adds {B}{R}{G}.
|
||||
Ability ability = new SimpleManaAbility(
|
||||
Zone.BATTLEFIELD, new YurlokOfScorchThrashManaEffect(), new GenericManaCost(1)
|
||||
);
|
||||
ability.addCost(new TapSourceCost());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private YurlokOfScorchThrash(final YurlokOfScorchThrash card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public YurlokOfScorchThrash copy() {
|
||||
return new YurlokOfScorchThrash(this);
|
||||
}
|
||||
}
|
||||
|
||||
class YurlokOfScorchThrashRuleEffect extends ContinuousEffectImpl {
|
||||
|
||||
YurlokOfScorchThrashRuleEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
staticText = "A player losing unspent mana causes that player to lose that much life.";
|
||||
}
|
||||
|
||||
private YurlokOfScorchThrashRuleEffect(final YurlokOfScorchThrashRuleEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public YurlokOfScorchThrashRuleEffect copy() {
|
||||
return new YurlokOfScorchThrashRuleEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
game.getState().setManaBurn(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.RulesEffects;
|
||||
}
|
||||
}
|
||||
|
||||
class YurlokOfScorchThrashManaEffect extends ManaEffect {
|
||||
|
||||
YurlokOfScorchThrashManaEffect() {
|
||||
super();
|
||||
staticText = "each player adds {B}{R}{G}";
|
||||
}
|
||||
|
||||
private YurlokOfScorchThrashManaEffect(final YurlokOfScorchThrashManaEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public YurlokOfScorchThrashManaEffect copy() {
|
||||
return new YurlokOfScorchThrashManaEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
Mana manaToAdd = produceMana(game, source);
|
||||
if (manaToAdd == null || manaToAdd.count() <= 0) {
|
||||
continue;
|
||||
}
|
||||
checkToFirePossibleEvents(manaToAdd, game, source);
|
||||
addManaToPool(player, manaToAdd, game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
netMana.add(new Mana(1, 1, 0, 0, 1, 0, 0, 0));
|
||||
return netMana;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mana produceMana(Game game, Ability source) {
|
||||
return new Mana(1, 1, 0, 0, 1, 0, 0, 0);
|
||||
}
|
||||
}
|
|
@ -544,6 +544,7 @@ public final class CommanderLegends extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Xenagos, God of Revels", 541, Rarity.MYTHIC, mage.cards.x.XenagosGodOfRevels.class));
|
||||
cards.add(new SetCardInfo("Yavimaya Elder", 441, Rarity.COMMON, mage.cards.y.YavimayaElder.class));
|
||||
cards.add(new SetCardInfo("Yuriko, the Tiger's Shadow", 542, Rarity.MYTHIC, mage.cards.y.YurikoTheTigersShadow.class));
|
||||
cards.add(new SetCardInfo("Yurlok of Scorch Thrash", 293, Rarity.RARE, mage.cards.y.YurlokOfScorchThrash.class));
|
||||
cards.add(new SetCardInfo("Zara, Renegade Recruiter", 294, Rarity.RARE, mage.cards.z.ZaraRenegadeRecruiter.class));
|
||||
cards.add(new SetCardInfo("Zedruu the Greathearted", 543, Rarity.MYTHIC, mage.cards.z.ZedruuTheGreathearted.class));
|
||||
cards.add(new SetCardInfo("Zur the Enchanter", 544, Rarity.MYTHIC, mage.cards.z.ZurTheEnchanter.class));
|
||||
|
|
|
@ -1540,7 +1540,10 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
@Override
|
||||
public void emptyManaPools() {
|
||||
for (Player player : getPlayers().values()) {
|
||||
player.getManaPool().emptyPool(this);
|
||||
int amount = player.getManaPool().emptyPool(this);
|
||||
if (state.isManaBurn() && amount > 0) {
|
||||
player.loseLife(amount, this, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
private int permanentOrderNumber;
|
||||
private final Map<UUID, FilterCreaturePermanent> usePowerInsteadOfToughnessForDamageLethalityFilters = new HashMap<>();
|
||||
private Set<MageObjectReference> commandersToStay = new HashSet<>(); // commanders that do not go back to command zone
|
||||
private boolean manaBurn = false;
|
||||
|
||||
private int applyEffectsCounter; // Upcounting number of each applyEffects execution
|
||||
|
||||
|
@ -1089,6 +1090,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
state.clearAbilities();
|
||||
}
|
||||
cardAttribute.clear();
|
||||
this.setManaBurn(false);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
|
@ -1269,4 +1271,12 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
void setCommanderShouldStay(Card card, Game game) {
|
||||
commandersToStay.add(new MageObjectReference(card, game));
|
||||
}
|
||||
|
||||
public void setManaBurn(boolean manaBurn) {
|
||||
this.manaBurn = manaBurn;
|
||||
}
|
||||
|
||||
public boolean isManaBurn() {
|
||||
return manaBurn;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue