Page 118 of 141
Re: Card Development Questions

Posted:
31 May 2013, 00:15
by Max mtg
Priority is not a problem before the opponent (ai) passes in under a second. The rest really matters.
Then it is to become a static ability that changes game rules - there was something made in that way alreadt
Re: Card Development Questions

Posted:
02 Jun 2013, 09:30
by Max mtg
Is the second ability of
Sovereigns of Lost Alara scriptable?
It could be triggered by DeclareAttackers, condition = SingleAttacker
(The current hardcoded implementation can be bugged: apply
Turn to Frog, but the abillity will trigger anyway)
Re: Card Development Questions

Posted:
02 Jun 2013, 11:23
by friarsol
Max mtg wrote:Is the second ability of
Sovereigns of Lost Alara scriptable?
It could be triggered by DeclareAttackers, condition = SingleAttacker
(The current hardcoded implementation can be bugged: apply
Turn to Frog, but the abillity will trigger anyway)
It might be. The whole "could be enchanted by" is definitely tricky, but we have other cards that I believe are scripted that use similar verbiage.
Re: Card Development Questions

Posted:
02 Jun 2013, 12:18
by Max mtg
Others are:
Bruna, Light of AlabasterAuratouched MageI would appreciate the script if anyone composes it.
Re: Card Development Questions

Posted:
02 Jun 2013, 13:19
by swordshine
Update "CanEnchantSource" to handle situations that can enchant remembered card. Remember the triggered attacker first, then apply changezone effect.
- Sovereigns of Lost Alara | Open
- Code: Select all
### Eclipse Workspace Patch 1.0
#P trunk
Index: src/main/java/forge/game/phase/CombatUtil.java
===================================================================
--- src/main/java/forge/game/phase/CombatUtil.java (revision 21901)
+++ src/main/java/forge/game/phase/CombatUtil.java (working copy)
@@ -1300,62 +1300,6 @@
game.getStack().addSimultaneousStackEntry(ability);
}
-
- final Player phasingPlayer = c.getController();
-
- if (phasingPlayer.getCardsIn(ZoneType.Battlefield, "Sovereigns of Lost Alara").size() > 0) {
- for (int i = 0; i < phasingPlayer.getCardsIn(ZoneType.Battlefield, "Sovereigns of Lost Alara").size(); i++) {
- final Card attacker = c;
- final Ability ability4 = new Ability(c, ManaCost.ZERO) {
- @Override
- public void resolve() {
- List<Card> enchantments =
- CardLists.filter(attacker.getController().getCardsIn(ZoneType.Library), new Predicate<Card>() {
- @Override
- public boolean apply(final Card c) {
- if (attacker.hasKeyword("Protection from enchantments")
- || (attacker.hasKeyword("Protection from everything"))) {
- return false;
- }
- return (c.isEnchantment() && c.hasKeyword("Enchant creature") && !CardFactoryUtil
- .hasProtectionFrom(c, attacker));
- }
- });
- final Player player = attacker.getController();
- Card enchantment = null;
- if (player.isHuman()) {
- final Card[] target = new Card[enchantments.size()];
- for (int j = 0; j < enchantments.size(); j++) {
- final Card crd = enchantments.get(j);
- target[j] = crd;
- }
- final Object check = GuiChoose.oneOrNone(
- "Select enchantment to enchant exalted creature", target);
- if (check != null) {
- enchantment = ((Card) check);
- }
- } else {
- enchantment = ComputerUtilCard.getBestEnchantmentAI(enchantments, this, false);
- }
- if ((enchantment != null) && attacker.isInPlay()) {
- game.getAction().changeZone(game.getZoneOf(enchantment),
- enchantment.getOwner().getZone(ZoneType.Battlefield), enchantment, null);
- enchantment.enchantEntity(attacker);
- }
- attacker.getController().shuffle();
- } // resolve
- }; // ability4
-
- final StringBuilder sb4 = new StringBuilder();
- sb4.append(c).append(
- " - (Exalted) searches library for an Aura card that could enchant that creature, ");
- sb4.append("put it onto the battlefield attached to that creature, then shuffles library.");
- ability4.setDescription(sb4.toString());
- ability4.setStackDescription(sb4.toString());
-
- game.getStack().addSimultaneousStackEntry(ability4);
- } // For
- }
}
/**
Index: src/main/java/forge/Card.java
===================================================================
--- src/main/java/forge/Card.java (revision 21901)
+++ src/main/java/forge/Card.java (working copy)
@@ -5429,9 +5429,22 @@
if (!source.equals(this.enchanting)) {
return false;
}
- } else if (property.startsWith("CanEnchantSource")) {
- if (!source.canBeEnchantedBy(this)) {
+ } else if (property.startsWith("CanEnchant")) {
+ final String restriction = property.substring(10);
+ if (restriction.equals("Remembered")) {
+ for (final Object rem : source.getRemembered()) {
+ if (rem instanceof Card) {
+ final Card card = (Card) rem;
+ if (card.canBeEnchantedBy(this)) {
+ return true;
+ }
+ }
+ }
return false;
+ } else {//CanEnchantSource
+ if (!source.canBeEnchantedBy(this)) {
+ return false;
+ }
}
} else if (property.startsWith("CanBeEnchantedBy")) {
if (property.substring(16).equals("Targeted")) {
Index: res/cardsfolder/s/sovereigns_of_lost_alara.txt
===================================================================
--- res/cardsfolder/s/sovereigns_of_lost_alara.txt (revision 21901)
+++ res/cardsfolder/s/sovereigns_of_lost_alara.txt (working copy)
@@ -1,9 +1,11 @@
Name:Sovereigns of Lost Alara
ManaCost:4 W U
Types:Creature Spirit
-Text:Whenever a creature you control attacks alone, you may search your library for an Aura card that could enchant that creature, put it onto the battlefield attached to that creature, then shuffle your library.
PT:4/5
K:Exalted
+T:Mode$ Attacks | ValidCard$ Creature.YouCtrl | Alone$ True | TriggerZones$ Battlefield | OptionalDecider$ You | Execute$ TrigSearch | TriggerDescription$ Whenever a creature you control attacks alone, you may search your library for an Aura card that could enchant that creature, put it onto the battlefield attached to that creature, then shuffle your library.
+SVar:TrigSearch:AB$ Pump | Cost$ 0 | RememberObjects$ TriggeredAttacker | SubAbility$ DBMoveAura
+SVar:DBMoveAura:DB$ ChangeZone | Origin$ Library | Destination$ Battlefield | ChangeType$ Aura.CanEnchantRemembered+YouCtrl | AttachedTo$ Remembered | ChangeNum$ 1 | Hidden$ True
SVar:RemRandomDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/sovereigns_of_lost_alara.jpg
Oracle:Exalted (Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn.)\nWhenever a creature you control attacks alone, you may search your library for an Aura card that could enchant that creature, put it onto the battlefield attached to that creature, then shuffle your library.
Re: Card Development Questions

Posted:
02 Jun 2013, 15:37
by Max mtg
swordshine wrote:Update "CanEnchantSource" to handle situations that can enchant remembered card. Remember the triggered attacker first, then apply changezone effect.
That's extactly what was needed! Thank you.
Now there'll be 1 less call to isHuman/isComputer and one less hardcoded ability
Re: Card Development Questions

Posted:
02 Jun 2013, 17:45
by Max mtg
The following cards now have the effect that was missing to implement them:
Odric, Master TacticianMaster WarcraftMeleeFeel free to write card scripts.
Sample card using the new effect
- Code: Select all
Name:Aaaaa
ManaCost:U
Types:Instant
A:SP$ DeclareCombatants | Cost$ U | DeclareAttackers$ True | DeclareBlockers$ True
SVar:Picture:http://resources.wizards.com/magic/cards/2u/en-us/card692.jpg
Oracle:You decide who does what
Re: Card Development Questions

Posted:
02 Jun 2013, 18:08
by Sloth
Max mtg wrote:The following cards now have the effect that was missing to implement them:
Odric, Master TacticianMaster WarcraftMeleeFeel free to write card scripts.
Sample card using the new effect
- Code: Select all
Name:Aaaaa
ManaCost:U
Types:Instant
A:SP$ DeclareCombatants | Cost$ U | DeclareAttackers$ True | DeclareBlockers$ True
SVar:Picture:http://resources.wizards.com/magic/cards/2u/en-us/card692.jpg
Oracle:You decide who does what
I miss a duration parameter in this ability,
Odric, Master Tactician lasts only for one combat,
Master Warcraft for a whole turn.
Re: Card Development Questions

Posted:
02 Jun 2013, 18:27
by Max mtg
Oh.. there's really a difference!
Ok then, r21915
PS: And of course change whatever you like about implementation if anything is wrong or missing. I've only set up a general path to implementation.
Re: Card Development Questions

Posted:
02 Jun 2013, 20:45
by moomarc
Sweet!

Thanks Max!
Re: Card Development Questions

Posted:
05 Jun 2013, 09:56
by mark
Is
Heat Wave forgable? Blue creatures can't block is probably no problem, I am not sure about the second part.
Re: Card Development Questions

Posted:
05 Jun 2013, 11:33
by swordshine
mark wrote:Is
Heat Wave forgable? Blue creatures can't block is probably no problem, I am not sure about the second part.
The second static ability might be scripted using "CantBlockUnless".
Re: Card Development Questions

Posted:
05 Jun 2013, 12:23
by swordshine
I'm afraid one of our planeswalkers,
Chandra, the Firebrand, is not perfectly scripted. Her second ability creates an effect with a delayed triggered ability that will copy the next instant or sorcery spell, then the effect will be removed after the trigger resolves. However, I could cast another instant spell before the trigger resolves that will fire the trigger again. A "TriggerLimit" parameter is very essential to fix this bug.
Re: Card Development Questions

Posted:
05 Jun 2013, 12:30
by Max mtg
Are there are triggers with more than one intented 'triggers'? If not, there would come handy a self-destruct option. One the trigger has fired, it destroys its host, or detaches itself
Re: Card Development Questions

Posted:
05 Jun 2013, 20:44
by Max mtg
Check the r21987
I wrote a small frament of code to trigger handler that removes the effect from command zone after it's ability went to stack
It is safe to do so? (I just wanted to remove the effect - fire no triggers, execute no change zones, etc.)
If it is, the last chancellor from NPH becomes scriptable