mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
- refactored Krovikan Vampire.
This commit is contained in:
parent
83d8f5a538
commit
ae00a74b4c
1 changed files with 14 additions and 16 deletions
|
@ -47,7 +47,7 @@ public final class KrovikanVampire extends CardImpl {
|
||||||
Zone.BATTLEFIELD,
|
Zone.BATTLEFIELD,
|
||||||
new KrovikanVampireEffect(),
|
new KrovikanVampireEffect(),
|
||||||
TargetController.ANY,
|
TargetController.ANY,
|
||||||
KrovikanVampireInterveningIfCondition.instance,
|
new KrovikanVampireInterveningIfCondition(),
|
||||||
false);
|
false);
|
||||||
ability.addWatcher(new KrovikanVampireCreaturesDamagedWatcher());
|
ability.addWatcher(new KrovikanVampireCreaturesDamagedWatcher());
|
||||||
ability.addWatcher(new KrovikanVampireCreaturesDiedWatcher());
|
ability.addWatcher(new KrovikanVampireCreaturesDiedWatcher());
|
||||||
|
@ -85,14 +85,17 @@ class KrovikanVampireEffect extends OneShotEffect {
|
||||||
if (creaturesAffected != null
|
if (creaturesAffected != null
|
||||||
&& controller != null
|
&& controller != null
|
||||||
&& krovikanVampire != null) {
|
&& krovikanVampire != null) {
|
||||||
for (UUID creatureId : creaturesAffected) {
|
creaturesAffected.stream().map((creatureId) -> {
|
||||||
controller.moveCards(game.getCard(creatureId), Zone.BATTLEFIELD, source, game, false, false, false, null);
|
controller.moveCards(game.getCard(creatureId), Zone.BATTLEFIELD, source, game, false, false, false, null);
|
||||||
|
return creatureId;
|
||||||
|
}).map((creatureId) -> {
|
||||||
OneShotEffect effect = new SacrificeTargetEffect();
|
OneShotEffect effect = new SacrificeTargetEffect();
|
||||||
effect.setText("Sacrifice this if Krovikan Vampire leaves the battlefield or its current controller loses control of it.");
|
effect.setText("Sacrifice this if Krovikan Vampire leaves the battlefield or its current controller loses control of it.");
|
||||||
effect.setTargetPointer(new FixedTarget(creatureId));
|
effect.setTargetPointer(new FixedTarget(creatureId));
|
||||||
KrovikanVampireDelayedTriggeredAbility dTA = new KrovikanVampireDelayedTriggeredAbility(effect, krovikanVampire.getId());
|
return effect;
|
||||||
|
}).map((effect) -> new KrovikanVampireDelayedTriggeredAbility(effect, krovikanVampire.getId())).forEachOrdered((dTA) -> {
|
||||||
game.addDelayedTriggeredAbility(dTA, source);
|
game.addDelayedTriggeredAbility(dTA, source);
|
||||||
}
|
});
|
||||||
creaturesAffected.clear();
|
creaturesAffected.clear();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -105,9 +108,8 @@ class KrovikanVampireEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum KrovikanVampireInterveningIfCondition implements Condition {
|
class KrovikanVampireInterveningIfCondition implements Condition {
|
||||||
|
|
||||||
instance;
|
|
||||||
Set<UUID> creaturesAffected = new HashSet<>();
|
Set<UUID> creaturesAffected = new HashSet<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -116,16 +118,12 @@ enum KrovikanVampireInterveningIfCondition implements Condition {
|
||||||
KrovikanVampireCreaturesDamagedWatcher watcherDamaged = game.getState().getWatcher(KrovikanVampireCreaturesDamagedWatcher.class);
|
KrovikanVampireCreaturesDamagedWatcher watcherDamaged = game.getState().getWatcher(KrovikanVampireCreaturesDamagedWatcher.class);
|
||||||
if (watcherDied != null) {
|
if (watcherDied != null) {
|
||||||
Set<UUID> creaturesThatDiedThisTurn = watcherDied.getDiedThisTurn();
|
Set<UUID> creaturesThatDiedThisTurn = watcherDied.getDiedThisTurn();
|
||||||
for (UUID mor : creaturesThatDiedThisTurn) {
|
creaturesThatDiedThisTurn.stream().filter((mor) -> (watcherDamaged != null)).forEachOrdered((mor) -> {
|
||||||
if (watcherDamaged != null) {
|
watcherDamaged.getDamagedBySource().stream().filter((mor2) -> (mor2 != null
|
||||||
for (UUID mor2 : watcherDamaged.getDamagedBySource()) {
|
&& mor == mor2)).forEachOrdered((_item) -> {
|
||||||
if (mor2 != null
|
creaturesAffected.add(mor);
|
||||||
&& mor == mor2) {
|
});
|
||||||
creaturesAffected.add(mor);
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (creaturesAffected != null
|
if (creaturesAffected != null
|
||||||
&& creaturesAffected.size() > 0) {
|
&& creaturesAffected.size() > 0) {
|
||||||
game.getState().setValue(source.getSourceId() + "creatureToGainControl", creaturesAffected);
|
game.getState().setValue(source.getSourceId() + "creatureToGainControl", creaturesAffected);
|
||||||
|
|
Loading…
Reference in a new issue