convert all gain rules to use MagicAbilityList
parent
e6f7e8a860
commit
495786686d
|
@ -7,6 +7,6 @@ type=Legendary,Creature
|
|||
subtype=Human,Artificer
|
||||
cost={W}{U}{B}
|
||||
pt=2/2
|
||||
ability=pay {W}{B}:Target artifact creature gains deathtouch and lifelink until end of turn.
|
||||
ability=pay {W}{B}:Target artifact creature gains deathtouch, lifelink until end of turn.
|
||||
timing=main
|
||||
requires_groovy_code
|
||||
|
|
|
@ -18,12 +18,20 @@ public class MagicGainAbilityAction extends MagicAction {
|
|||
private final MagicAbilityList abilityList;
|
||||
private final boolean duration;
|
||||
|
||||
public MagicGainAbilityAction(final MagicPermanent permanent,final Set<MagicAbility> abilities, final boolean duration) {
|
||||
public MagicGainAbilityAction(final MagicPermanent permanent,final MagicAbilityList abilityList, final boolean duration) {
|
||||
this.permanent=permanent;
|
||||
this.abilityList=MagicAbility.getAbilityList(abilities);
|
||||
this.abilityList=abilityList;
|
||||
this.duration=duration;
|
||||
}
|
||||
|
||||
public MagicGainAbilityAction(final MagicPermanent permanent,final Set<MagicAbility> abilities, final boolean duration) {
|
||||
this(permanent,MagicAbility.getAbilityList(abilities), duration);
|
||||
}
|
||||
|
||||
public MagicGainAbilityAction(final MagicPermanent permanent,final MagicAbilityList abilityList) {
|
||||
this(permanent,abilityList,MagicStatic.UntilEOT);
|
||||
}
|
||||
|
||||
public MagicGainAbilityAction(final MagicPermanent permanent,final List<MagicAbility> abilities) {
|
||||
this(permanent,EnumSet.copyOf(abilities),MagicStatic.UntilEOT);
|
||||
}
|
||||
|
|
|
@ -530,7 +530,7 @@ public enum MagicRuleEventAction {
|
|||
) {
|
||||
public MagicEventAction getAction(final String rule) {
|
||||
final Matcher matcher = matched(rule);
|
||||
final MagicAbility ability = MagicAbility.getAbility(matcher.group("ability"));
|
||||
final MagicAbilityList abilityList = MagicAbility.getAbilityList(matcher.group("ability"));
|
||||
final String[] pt = matcher.group("pt").replace("+","").split("/");
|
||||
final int power = Integer.parseInt(pt[0]);
|
||||
final int toughness = Integer.parseInt(pt[1]);
|
||||
|
@ -540,7 +540,7 @@ public enum MagicRuleEventAction {
|
|||
event.processTargetPermanent(game,new MagicPermanentAction() {
|
||||
public void doAction(final MagicPermanent creature) {
|
||||
game.doAction(new MagicChangeTurnPTAction(creature,power,toughness));
|
||||
game.doAction(new MagicGainAbilityAction(creature,ability));
|
||||
game.doAction(new MagicGainAbilityAction(creature,abilityList));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -671,7 +671,7 @@ public enum MagicRuleEventAction {
|
|||
) {
|
||||
public MagicEventAction getAction(final String rule) {
|
||||
final Matcher matcher = matched(rule);
|
||||
final MagicAbility ability = MagicAbility.getAbility(matcher.group("ability"));
|
||||
final MagicAbilityList abilityList = MagicAbility.getAbilityList(matcher.group("ability"));
|
||||
final String[] pt = matcher.group("pt").replace("+","").split("/");
|
||||
final int power = Integer.parseInt(pt[0]);
|
||||
final int toughness = Integer.parseInt(pt[1]);
|
||||
|
@ -681,7 +681,7 @@ public enum MagicRuleEventAction {
|
|||
event.processTargetPermanent(game,new MagicPermanentAction() {
|
||||
public void doAction(final MagicPermanent creature) {
|
||||
game.doAction(new MagicChangeTurnPTAction(creature,power,toughness));
|
||||
game.doAction(new MagicGainAbilityAction(creature,ability));
|
||||
game.doAction(new MagicGainAbilityAction(creature,abilityList));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -737,13 +737,13 @@ public enum MagicRuleEventAction {
|
|||
) {
|
||||
public MagicEventAction getAction(final String rule) {
|
||||
final Matcher matcher = matched(rule);
|
||||
final MagicAbility ability = MagicAbility.getAbility(matcher.group("ability"));
|
||||
final MagicAbilityList abilityList = MagicAbility.getAbilityList(matcher.group("ability"));
|
||||
return new MagicEventAction() {
|
||||
@Override
|
||||
public void executeEvent(final MagicGame game, final MagicEvent event) {
|
||||
event.processTargetPermanent(game,new MagicPermanentAction() {
|
||||
public void doAction(final MagicPermanent creature) {
|
||||
game.doAction(new MagicGainAbilityAction(creature,ability));
|
||||
game.doAction(new MagicGainAbilityAction(creature,abilityList));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue