updated Bonfire of the Damned, added a new method for getting a player or planeswalker's controller

This commit is contained in:
Evan Kranzler 2018-04-19 16:01:44 -04:00
parent 9fe08dd438
commit 1e27d7222a
3 changed files with 24 additions and 9 deletions

View file

@ -52,7 +52,6 @@ public class BonfireOfTheDamned extends CardImpl {
public BonfireOfTheDamned(UUID ownerId, CardSetInfo setInfo) { public BonfireOfTheDamned(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{X}{R}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{X}{R}");
// Bonfire of the Damned deals X damage to target player and each creature he or she controls. // Bonfire of the Damned deals X damage to target player and each creature he or she controls.
this.getSpellAbility().addEffect(new BonfireOfTheDamnedEffect()); this.getSpellAbility().addEffect(new BonfireOfTheDamnedEffect());
this.getSpellAbility().addTarget(new TargetPlayer()); this.getSpellAbility().addTarget(new TargetPlayer());
@ -77,7 +76,7 @@ class BonfireOfTheDamnedEffect extends OneShotEffect {
public BonfireOfTheDamnedEffect() { public BonfireOfTheDamnedEffect() {
super(Outcome.Damage); super(Outcome.Damage);
staticText = "{this} deals X damage to target player and each creature he or she controls"; staticText = "{this} deals X damage to target player or planeswalker and each creature that player or that planeswalkers controller controls";
} }
public BonfireOfTheDamnedEffect(final BonfireOfTheDamnedEffect effect) { public BonfireOfTheDamnedEffect(final BonfireOfTheDamnedEffect effect) {
@ -86,7 +85,7 @@ class BonfireOfTheDamnedEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget()); Player player = game.getPlayerOrPlaneswalkerController(source.getFirstTarget());
if (player != null) { if (player != null) {
int damage = source.getManaCostsToPay().getX(); int damage = source.getManaCostsToPay().getX();
if (damage > 0) { if (damage > 0) {

View file

@ -132,6 +132,8 @@ public interface Game extends MageItem, Serializable {
Player getPlayer(UUID playerId); Player getPlayer(UUID playerId);
Player getPlayerOrPlaneswalkerController(UUID playerId);
Players getPlayers(); Players getPlayers();
PlayerList getPlayerList(); PlayerList getPlayerList();

View file

@ -306,6 +306,20 @@ public abstract class GameImpl implements Game, Serializable {
return state.getPlayer(playerId); return state.getPlayer(playerId);
} }
@Override
public Player getPlayerOrPlaneswalkerController(UUID playerId) {
Player player = getPlayer(playerId);
if (player != null) {
return player;
}
Permanent permanent = getPermanent(playerId);
if (permanent == null) {
return null;
}
player = getPlayer(permanent.getControllerId());
return player;
}
@Override @Override
public MageObject getObject(UUID objectId) { public MageObject getObject(UUID objectId) {
if (objectId == null) { if (objectId == null) {