mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
* Urborg Syphon-Mage - Fixed that the activated ability could not be activated on battlefield.
This commit is contained in:
parent
bceef0ec48
commit
f3974e61af
1 changed files with 16 additions and 7 deletions
|
@ -41,6 +41,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -59,7 +60,7 @@ public class UrborgSyphonMage extends CardImpl<UrborgSyphonMage> {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// {2}{B}, {tap}, Discard a card: Each other player loses 2 life. You gain life equal to the life lost this way.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.HAND, new UrborgSyphonMageEffect(), new ManaCostsImpl("{2}{B}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UrborgSyphonMageEffect(), new ManaCostsImpl("{2}{B}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new DiscardCardCost());
|
||||
this.addAbility(ability);
|
||||
|
@ -89,13 +90,21 @@ class UrborgSyphonMageEffect extends OneShotEffect<UrborgSyphonMageEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int damage = 0;
|
||||
for (UUID playerId: game.getPlayerList() ){
|
||||
if(playerId != source.getControllerId()){
|
||||
damage += game.getPlayer(playerId).damage(2, source.getSourceId(), game, false, true);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
if (playerId != source.getControllerId()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
damage += player.damage(2, source.getSourceId(), game, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
game.getPlayer(source.getControllerId()).gainLife(damage, game);
|
||||
return true;
|
||||
}
|
||||
game.getPlayer(source.getControllerId()).gainLife(damage, game);
|
||||
return true;
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,4 +112,4 @@ class UrborgSyphonMageEffect extends OneShotEffect<UrborgSyphonMageEffect> {
|
|||
return new UrborgSyphonMageEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue