mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
refactoring
This commit is contained in:
parent
6e259cff81
commit
440ffe9f06
2 changed files with 12 additions and 10 deletions
|
@ -39,12 +39,12 @@ import mage.abilities.effects.common.AttachEffect;
|
|||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedCreatureEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -97,12 +97,11 @@ class SpitefulShadowsTriggeredAbility extends TriggeredAbilityImpl<SpitefulShado
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) {
|
||||
Permanent enchantment = game.getPermanent(sourceId);
|
||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||
if (event.getTargetId().equals(enchantment.getAttachedTo())) {
|
||||
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
|
||||
this.getEffects().get(0).setValue("targetId", event.getTargetId());
|
||||
return true;
|
||||
}
|
||||
UUID targetId = event.getTargetId();
|
||||
if (enchantment != null && enchantment.getAttachedTo() != null && targetId.equals(enchantment.getAttachedTo())) {
|
||||
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(targetId));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -133,11 +132,12 @@ class SpitefulShadowsEffect extends OneShotEffect<SpitefulShadowsEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Integer damageAmount = (Integer) this.getValue("damageAmount");
|
||||
UUID targetId = (UUID) this.getValue("targetId");
|
||||
UUID targetId = this.targetPointer.getFirst(source);
|
||||
if (damageAmount != null && targetId != null) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent == null)
|
||||
if (permanent == null) {
|
||||
permanent = (Permanent) game.getLastKnownInformation(targetId, Zone.BATTLEFIELD);
|
||||
}
|
||||
if (permanent != null) {
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
if (player != null) {
|
||||
|
|
|
@ -53,6 +53,8 @@ import mage.target.common.TargetCardInLibrary;
|
|||
*/
|
||||
public class SadisticSacrament extends CardImpl<SadisticSacrament> {
|
||||
|
||||
private static final String ruleText = "Search target player's library for up to three cards, exile them, then that player shuffles his or her library. If {this} was kicked, instead search that player's library for up to fifteen cards, exile them, then that player shuffles his or her library";
|
||||
|
||||
public SadisticSacrament(UUID ownerId) {
|
||||
super(ownerId, 110, "Sadistic Sacrament", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{B}{B}{B}");
|
||||
this.expansionSetCode = "ZEN";
|
||||
|
@ -67,7 +69,7 @@ public class SadisticSacrament extends CardImpl<SadisticSacrament> {
|
|||
new SadisticSacramentEffect(15),
|
||||
new SadisticSacramentEffect(3),
|
||||
KickedCondition.getInstance(),
|
||||
"Search target player's library for up to three cards, exile them, then that player shuffles his or her library. If Sadistic Sacrament was kicked, instead search that player's library for up to fifteen cards, exile them, then that player shuffles his or her library"));
|
||||
ruleText));
|
||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue