mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
* Chain of Vapor - Fixed that wrong player was asked for target change of copied spell.
This commit is contained in:
parent
e3dbe51255
commit
170920de6b
1 changed files with 11 additions and 8 deletions
|
@ -89,31 +89,34 @@ class ChainOfVaporEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (controller == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
if(!permanent.moveToZone(Zone.HAND, source.getId(), game, false)){
|
if (!controller.moveCardToHandWithInfo(permanent, source.getSourceId(), game, Zone.BATTLEFIELD)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = game.getPlayer(permanent.getControllerId());
|
Player player = game.getPlayer(permanent.getControllerId());
|
||||||
if(player.chooseUse(Outcome.ReturnToHand, "Sacrifice a land to copy this spell?", game)){
|
if (player.chooseUse(Outcome.ReturnToHand, "Sacrifice a land to copy this spell?", game)){
|
||||||
TargetControlledPermanent target = new TargetControlledPermanent(new FilterControlledLandPermanent());
|
TargetControlledPermanent target = new TargetControlledPermanent(new FilterControlledLandPermanent());
|
||||||
if(player.chooseTarget(Outcome.Sacrifice, target, source, game)){
|
if (player.chooseTarget(Outcome.Sacrifice, target, source, game)){
|
||||||
Permanent land = game.getPermanent(target.getFirstTarget());
|
Permanent land = game.getPermanent(target.getFirstTarget());
|
||||||
if(land != null){
|
if(land != null){
|
||||||
if(land.sacrifice(source.getId(), game)){
|
if(land.sacrifice(source.getId(), game)){
|
||||||
Spell spell = game.getStack().getSpell(source.getId());
|
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||||
if (spell != null) {
|
if (spell != null) {
|
||||||
Spell copy = spell.copySpell();
|
Spell copy = spell.copySpell();
|
||||||
copy.setControllerId(player.getId());
|
copy.setControllerId(player.getId());
|
||||||
copy.setCopiedSpell(true);
|
copy.setCopiedSpell(true);
|
||||||
game.getStack().push(copy);
|
game.getStack().push(copy);
|
||||||
copy.chooseNewTargets(game, source.getControllerId());
|
copy.chooseNewTargets(game, player.getId());
|
||||||
String activateMessage = copy.getActivatedMessage(game);
|
String activateMessage = copy.getActivatedMessage(game);
|
||||||
if (activateMessage.startsWith(" casts ")) {
|
if (activateMessage.startsWith(" casts ")) {
|
||||||
activateMessage = activateMessage.substring(6);
|
activateMessage = activateMessage.substring(6);
|
||||||
}
|
}
|
||||||
game.informPlayers(player.getName() + " copies " + activateMessage);;
|
game.informPlayers(player.getName() + " copies " + activateMessage);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue