Card Contributions
by ubeefx
Moderators: ubeefx, beholder, melvin, ShawnieBoy, Lodici, CCGHQ Admins
Re: Card Contributions
by muppet » 19 Mar 2015, 14:11
its done with this 353 * effect: Search your library for a card and put it into your hand. Then shuffle your library.
354 * effect: Search your library for up to <amount> <chosen>
…
1399 * effect: Search your library for <chosen> and put it onto the battlefield. Then shuffle your library.
1400 * effect: Put SN on top of its owner's library.
Which has no mention of timing as far as I can tell.
354 * effect: Search your library for up to <amount> <chosen>
…
1399 * effect: Search your library for <chosen> and put it onto the battlefield. Then shuffle your library.
1400 * effect: Put SN on top of its owner's library.
Which has no mention of timing as far as I can tell.
Re: Card Contributions
by ShawnieBoy » 19 Mar 2015, 20:22
Most searches have a timing of Draw (which I'm personally not keen on, as it's the same as Main).muppet wrote:its done with this 353 * effect: Search your library for a card and put it into your hand. Then shuffle your library.
354 * effect: Search your library for up to <amount> <chosen>
…
1399 * effect: Search your library for <chosen> and put it onto the battlefield. Then shuffle your library.
1400 * effect: Put SN on top of its owner's library.
Which has no mention of timing as far as I can tell.
It's in the MagicRuleEventAction.java SearchLibraryToHand
Looking at the timings, it's unlikely to sacrificed in response to an effect from the opponent during combat, or any other phase other than Main.
-
ShawnieBoy - Programmer
- Posts: 601
- Joined: 02 Apr 2012, 22:42
- Location: UK
- Has thanked: 80 times
- Been thanked: 50 times
Re: Card Contributions
by PalladiaMors » 22 Mar 2015, 00:37
Hi, could I please have some help with this one? I've already tried to do "target creature gains protection from the color of your choice" a bunch of times, but I can never get it right. It loads, but crashes during gameplay. It requires an event chain, and I can't seem able to get any of those cards right - there's something about them that I'm just incapable of understanding. Any help appreciated, lots of cards have this ability, would be a nice addition to the pool. And I have to get this one off my chest! Oh, this one is Mother of Runes.
- Code: Select all
def action = {
final MagicGame game, final MagicEvent event ->
event.processTargetPermanent(game, {
game.doAction(new MagicGainAbilityAction(it,event.getChosenColor().getProtectionAbility()));
});
}
[
new MagicPermanentActivation(
new MagicActivationHints(MagicTiming.Pump),
"Protection"
) {
@Override
public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
return [new MagicTapEvent(source)];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
MagicTargetChoice.TARGET_CREATURE_YOU_CONTROL,
this,
"Target creature you control\$ gains protection from the color of your choice until end of turn."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
game.addEvent(new MagicEvent(
event.getSource(),
MagicColorChoice.ALL_INSTANCE,
action,
"Chosen color\$."
));
}
}
]
- PalladiaMors
- Posts: 343
- Joined: 12 Jul 2014, 17:40
- Has thanked: 36 times
- Been thanked: 22 times
Re: Card Contributions
by ShawnieBoy » 22 Mar 2015, 01:36
Yes, I've never had any luck with these either - Kinda doubly confounded as the choice only occurs during resolution, which is also a bit of a no-no in Magarena.PalladiaMors wrote:Hi, could I please have some help with this one? I've already tried to do "target creature gains protection from the color of your choice" a bunch of times, but I can never get it right. It loads, but crashes during gameplay. It requires an event chain, and I can't seem able to get any of those cards right - there's something about them that I'm just incapable of understanding. Any help appreciated, lots of cards have this ability, would be a nice addition to the pool. And I have to get this one off my chest! Oh, this one is Mother of Runes.
- Code: Select all
def action = {
final MagicGame game, final MagicEvent event ->
event.processTargetPermanent(game, {
game.doAction(new MagicGainAbilityAction(it,event.getChosenColor().getProtectionAbility()));
});
}
[
new MagicPermanentActivation(
new MagicActivationHints(MagicTiming.Pump),
"Protection"
) {
@Override
public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
return [new MagicTapEvent(source)];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
MagicTargetChoice.TARGET_CREATURE_YOU_CONTROL,
this,
"Target creature you control\$ gains protection from the color of your choice until end of turn."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
game.addEvent(new MagicEvent(
event.getSource(),
MagicColorChoice.ALL_INSTANCE,
action,
"Chosen color\$."
));
}
}
]
It's a bit beyond me, maybe @Melvin will be able to shed some light on this, but I feer it enters the 'multiple targets' group of effects. A target and a choice.
-
ShawnieBoy - Programmer
- Posts: 601
- Joined: 02 Apr 2012, 22:42
- Location: UK
- Has thanked: 80 times
- Been thanked: 50 times
Re: Card Contributions
by melvin » 22 Mar 2015, 10:11
@Pallidiamors: Your original had two bugs:
1. in the event with the target, the corresponding executeEvent should use processTargetPermanent
2. the chosen permanent in the first event, should be passed into the second event, so that the second event can retrieve it as getRefPermanent
1. in the event with the target, the corresponding executeEvent should use processTargetPermanent
2. the chosen permanent in the first event, should be passed into the second event, so that the second event can retrieve it as getRefPermanent
- Code: Select all
def action = {
final MagicGame game, final MagicEvent event ->
game.doAction(new MagicGainAbilityAction(
event.getRefPermanent(),
event.getChosenColor().getProtectionAbility()
));
}
[
new MagicPermanentActivation(
new MagicActivationHints(MagicTiming.Pump),
"Protection"
) {
@Override
public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
return [new MagicTapEvent(source)];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
MagicTargetChoice.TARGET_CREATURE_YOU_CONTROL,
this,
"Target creature you control\$ gains protection from the color of your choice until end of turn."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPermanent(game, {
game.addEvent(new MagicEvent(
event.getSource(),
event.getPlayer(),
MagicColorChoice.ALL_INSTANCE,
it,
action,
"Chosen color\$."
));
});
}
}
]
-
melvin - AI Programmer
- Posts: 1062
- Joined: 21 Mar 2010, 12:26
- Location: Singapore
- Has thanked: 36 times
- Been thanked: 459 times
Re: Card Contributions
by melvin » 22 Mar 2015, 13:32
This looks like a fairly common ability, made it available in card script and added cards that can be implemented completely as card script.
-
melvin - AI Programmer
- Posts: 1062
- Joined: 21 Mar 2010, 12:26
- Location: Singapore
- Has thanked: 36 times
- Been thanked: 459 times
Re: Card Contributions
by muppet » 22 Mar 2015, 14:34
I found a card with a timing of draw which doesn't seem to be on the list in the timings table ?
Re: Card Contributions
by ShawnieBoy » 22 Mar 2015, 15:42
Main has it's aliases referenced at the bottom of the table: "Artifact", "Aura", "Draw", "Enchantment", "Equipment" and "Land" are all the same timing.muppet wrote:I found a card with a timing of draw which doesn't seem to be on the list in the timings table ?
-
ShawnieBoy - Programmer
- Posts: 601
- Joined: 02 Apr 2012, 22:42
- Location: UK
- Has thanked: 80 times
- Been thanked: 50 times
Re: Card Contributions
by ShawnieBoy » 22 Mar 2015, 15:49
Is the AI happy now with choices in resolution? I can remember a time when it wasn't working properly (I think it was in the design principles too)melvin wrote:@Pallidiamors: Your original had two bugs:
1. in the event with the target, the corresponding executeEvent should use processTargetPermanent
2. the chosen permanent in the first event, should be passed into the second event, so that the second event can retrieve it as getRefPermanent
- Code: Select all
def action = {
final MagicGame game, final MagicEvent event ->
game.doAction(new MagicGainAbilityAction(
event.getRefPermanent(),
event.getChosenColor().getProtectionAbility()
));
}
[
new MagicPermanentActivation(
new MagicActivationHints(MagicTiming.Pump),
"Protection"
) {
@Override
public Iterable<MagicEvent> getCostEvent(final MagicPermanent source) {
return [new MagicTapEvent(source)];
}
@Override
public MagicEvent getPermanentEvent(final MagicPermanent source,final MagicPayedCost payedCost) {
return new MagicEvent(
source,
MagicTargetChoice.TARGET_CREATURE_YOU_CONTROL,
this,
"Target creature you control\$ gains protection from the color of your choice until end of turn."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
event.processTargetPermanent(game, {
game.addEvent(new MagicEvent(
event.getSource(),
event.getPlayer(),
MagicColorChoice.ALL_INSTANCE,
it,
action,
"Chosen color\$."
));
});
}
}
]
I'm sure there must be other cards that could do with similar changes, though not off the top of my head.
-
ShawnieBoy - Programmer
- Posts: 601
- Joined: 02 Apr 2012, 22:42
- Location: UK
- Has thanked: 80 times
- Been thanked: 50 times
Re: Card Contributions
by muppet » 22 Mar 2015, 16:25
Ok sorry failed at reading as usual. The card in question is Ancestral Recall and you certainly don't want to play that only in main phase. For example the ai plays it when drawing 3 cards will cause it to discard which if it played it in opps end step it wouldn't.
Re: Card Contributions
by ShawnieBoy » 22 Mar 2015, 16:34
Yes, I've had this issue with instant cast Draw spells before (and activated abilities). I would prefer to remove Draw from main, sorcery draw cards can only be cast during those phases anyway.muppet wrote:Ok sorry failed at reading as usual. The card in question is Ancestral Recall and you certainly don't want to play that only in main phase. For example the ai plays it when drawing 3 cards will cause it to discard which if it played it in opps end step it wouldn't.
-
ShawnieBoy - Programmer
- Posts: 601
- Joined: 02 Apr 2012, 22:42
- Location: UK
- Has thanked: 80 times
- Been thanked: 50 times
Re: Card Contributions
by ShawnieBoy » 23 Mar 2015, 05:19
Just noticed Apostle's Blessing and Razor Barrier in the submissions.
As they stand at the moment they've been converted into modal effects - however the choice isn't made until resolution. (Think of them as being 'gains protection from the colour of your choice, including artifacts')
As they stand at the moment they've been converted into modal effects - however the choice isn't made until resolution. (Think of them as being 'gains protection from the colour of your choice, including artifacts')
-
ShawnieBoy - Programmer
- Posts: 601
- Joined: 02 Apr 2012, 22:42
- Location: UK
- Has thanked: 80 times
- Been thanked: 50 times
Re: Card Contributions
by PalladiaMors » 25 Mar 2015, 18:39
I'm trying to code the ability Kinship (script below is supposed to be Wolf-Skull Shaman). Unfortunately, the second event is broken: you can't choose either yes or no, the game doesn't crash or freeze, but it hangs (you can't get away from the choice). I'm trying to figure out ways around this, in particular I'm thinking about getting rid of the first may choice, since there's no reason the player wouldn't want to look at his top card. However, if there's a way to do the card strictly according to its wording, I guess it would be better. Any ideas greatly appreciated!
- Code: Select all
def action = {
final MagicGame game, final MagicEvent event ->
if (event.isYes()) {
game.doAction(new MagicRevealAction(event.getRefCard()));
game.doAction(new MagicPlayTokenAction(event.getPlayer(),TokenCardDefinitions.get("2/2 green Wolf creature token")));
}
}
[
new MagicAtYourUpkeepTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
return new MagicEvent(
permanent,
new MagicMayChoice(),
this,
"PN may\$ look at the top card of his of her library. If it shares a creature type with SN, you may reveal it."
);
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
if (event.isYes()) {
for (final MagicCard card : event.getPlayer().getLibrary().getCardsFromTop(1)) {
game.doAction(new MagicLookAction(card, event.getPlayer(), "top card of your library"));
for (final MagicSubType subtype : MagicSubType.values()) {
if (card.hasSubType(subtype) == event.getPermanent().hasSubType(subtype)) {
game.addEvent(new MagicEvent(
event.getSource(),
event.getPlayer(),
new MagicMayChoice("Reveal the top card of your library?"),
card,
action,
"PN may\$ reveal the top card of his library. If you do, put a 2/2 green Wolf creature token onto the battlefield."
));
}
}
}
}
}
}
]
- Code: Select all
[
new MagicAtYourUpkeepTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
for (final MagicCard card : upkeepPlayer.getLibrary().getCardsFromTop(1)) {
game.doAction(new MagicLookAction(card, upkeepPlayer, "top card of your library"));
for (final MagicSubType subtype : MagicSubType.values()) {
return card.hasSubType(subtype) == permanent.hasSubType(subtype) ?
new MagicEvent(
permanent,
new MagicMayChoice(),
card,
this,
"PN may\$ reveal the top card of PN's library. If you do, put a 2/2 green Wolf creature token onto the battlefield."
):
MagicEvent.NONE;
}
}
}
@Override
public void executeEvent(final MagicGame game, final MagicEvent event) {
if (event.isYes()) {
game.doAction(new MagicRevealAction(event.getRefCard()));
game.doAction(new MagicPlayTokenAction(event.getPlayer(),TokenCardDefinitions.get("2/2 green Wolf creature token")));
}
}
}
]
- PalladiaMors
- Posts: 343
- Joined: 12 Jul 2014, 17:40
- Has thanked: 36 times
- Been thanked: 22 times
Re: Card Contributions
by PalladiaMors » 27 Mar 2015, 11:49
Submitted a small fix for Forsaken Wastes (last ability should trigger for either player, not just opponent).
- PalladiaMors
- Posts: 343
- Joined: 12 Jul 2014, 17:40
- Has thanked: 36 times
- Been thanked: 22 times
Re: Card Contributions
by PalladiaMors » 01 Apr 2015, 18:57
I've started to work on the Urza's "untap up to X lands" cards (Frantic Search & co.). While I don't know how to code the "up to" part, I've noticed that you can select an already untapped land if you don't want to untap others (the cards don't mention that the lands must be tapped). Also, now that there's no more mana burn, I can't think of a possible reason not to untap either (before maybe you could consider something like Citadel of Pain). I think it's solid to do the cards this way, and these are popular cards that will enable a bunch of decks.
- PalladiaMors
- Posts: 343
- Joined: 12 Jul 2014, 17:40
- Has thanked: 36 times
- Been thanked: 22 times
Who is online
Users browsing this forum: No registered users and 55 guests