mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 12:49:39 -08:00
* Fixed that sacrifice was handled targeted (because of using other method now with sourceId and controllerId).
This commit is contained in:
parent
7af34eb8b1
commit
e22174b148
3 changed files with 28 additions and 15 deletions
|
|
@ -82,24 +82,29 @@ class MomentousFallEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int power = 0;
|
||||
int toughness = 0;
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
|
||||
for (Cost cost: source.getCosts()) {
|
||||
if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost)cost).getPermanents().size() > 0) {
|
||||
power = ((SacrificeTargetCost)cost).getPermanents().get(0).getPower().getValue();
|
||||
toughness = ((SacrificeTargetCost)cost).getPermanents().get(0).getToughness().getValue();
|
||||
break;
|
||||
int power = 0;
|
||||
int toughness = 0;
|
||||
|
||||
for (Cost cost : source.getCosts()) {
|
||||
if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) {
|
||||
power = ((SacrificeTargetCost) cost).getPermanents().get(0).getPower().getValue();
|
||||
toughness = ((SacrificeTargetCost) cost).getPermanents().get(0).getToughness().getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (power > 0) {
|
||||
controller.drawCards(power, game);
|
||||
}
|
||||
if (toughness > 0) {
|
||||
controller.gainLife(toughness, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (power > 0) {
|
||||
player.drawCards(power, game);
|
||||
}
|
||||
if (toughness > 0) {
|
||||
player.gainLife(toughness, game);
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue