It is currently 12 Sep 2025, 23:12
   
Text Size

A guide to the AI of planeswalkers using ability factories

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Re: A guide to the AI of planeswalkers using ability factori

Postby friarsol » 29 Oct 2011, 12:15

I believe Chandra Nalaar is scriptable now as well.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: A guide to the AI of planeswalkers using ability factori

Postby jeffwadsworth » 29 Oct 2011, 16:19

friarsol wrote:I believe Chandra Nalaar is scriptable now as well.
Wouldn't we need a:
DB$ DamageAll | ValidCards$ Creature.TargetedPlayerCtrl
for the Ultimate?

Unless you know of another way?
jeffwadsworth
Super Tester Elite
 
Posts: 1172
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 70 times

Re: A guide to the AI of planeswalkers using ability factori

Postby Sloth » 29 Oct 2011, 18:13

jeffwadsworth wrote:
friarsol wrote:I believe Chandra Nalaar is scriptable now as well.
Wouldn't we need a:
DB$ DamageAll | ValidCards$ Creature.TargetedPlayerCtrl
for the Ultimate?

Unless you know of another way?
It's scriptable. Take a look at Flame Wave.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: A guide to the AI of planeswalkers using ability factori

Postby slapshot5 » 04 Nov 2011, 22:51

I think Jace, the Mind Sculptor can be completely scripted too.

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: A guide to the AI of planeswalkers using ability factori

Postby jeffwadsworth » 05 Nov 2011, 00:27

slapshot5 wrote:I think Jace, the Mind Sculptor can be completely scripted too.

-slapshot5
I get an error when commenting out the Jace code. Here is a script that someone can test if they wish. Not tested at all due to that error.

| Open
Name:Jace, the Mind Sculptor
ManaCost:2 U U
Types:Planeswalker Jace
Text:no text
Loyalty:3
A:AB$ Dig | Cost$ AddCounter<2/LOYALTY> | ValidTgts$ Player | TgtPrompt$ Select target player | DigNum$ 1 | AnyNumber$ True | DestinationZone$ Library | LibraryPosition2$ 0 | Planeswalker$ True | SpellDescription$ Look at the top card of target player's library. You may put that card on the bottom of that player's library.
A:AB$ Draw | Cost$ 0 | NumCards$ 3 | SubAbility$ DBChangeZone | Planeswalker$ True | SpellDescription$ Draw three cards, then put two cards from your hand on top of your library in any order.
SVar:DBChangeZone:DB$ ChangeZone | Origin$ Hand | Destination$ Library | ChangeType$ Card.YouCtrl | ChangeNum$ 2 | LibraryPosition$ 0
A:AB$ ChangeZone | Cost$ SubCounter<1/LOYALTY> Origin$ Battlefield | Destination$ Hand | Hidden$ True | ValidTgts$ Creature | TgtPrompt$ Select target creature | Planeswalker$ True | SpellDescription$ Return target creature to its owner's hand.
A:AB$ ChangeZoneAll | Cost$ SubCounter<12/LOYALTY> | Origin$ Library | Destination$ Exile | ValidTgts$ Player | TgtPrompt$ Select target player | SubAbility$ DBChangeZone2 | Planeswalker$ True | Ultimate$ True | SpellDescription$ Exile all cards from target player's library, then that player shuffles his or her hand into his or her library.
SVar:DBChangeZone2:DB$ ChangeZoneAll | Origin$ Hand | Destination$ Library | Defined$ Targeted | ChangeType$ Card | Shuffle$ True
SVar:Rarity:Mythic
SVar:Picture:http://www.wizards.com/global/images/magic/general/jace_the_mind_sculptor.jpg
SetInfo:WWK|Mythic|http://magiccards.info/scans/en/wwk/31.jpg
Oracle:[+2] Look at the top card of target player's library. You may put that card on the bottom of that player's library.\n[0] Draw three cards, then put two cards from your hand on top of your library in any order.\n[-1] Return target creature to its owner's hand.\n[-12] Exile all cards from target player's library, then that player shuffles his or her hand into his or her library.
End
jeffwadsworth
Super Tester Elite
 
Posts: 1172
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 70 times

Re: A guide to the AI of planeswalkers using ability factori

Postby slapshot5 » 05 Nov 2011, 02:21

jeffwadsworth wrote:I get an error when commenting out the Jace code. Here is a script that someone can test if they wish. Not tested at all due to that error.
What kind of error do you get?
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: A guide to the AI of planeswalkers using ability factori

Postby friarsol » 05 Nov 2011, 03:09

jeffwadsworth wrote:
slapshot5 wrote:and Tezzeret the Seeker
I will add it tomorrow unless someone else does it. Sleep beckons.
Hey Jeff, where's Tez? If you did any local work with Tez, maybe it's part of why you have an error with Jace 2.0?
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: A guide to the AI of planeswalkers using ability factori

Postby friarsol » 05 Nov 2011, 03:37

If Jace 2.0 and Tez are converted soon, as they appear they will be, only Sarkhan the Mad remains.

Here's the scoop:

1st Ability: Basically Dark Confidant with Damage to Self instead of You Losing Life. (Easy)

2nd Ability: "Target creature's controller sacrifices it." We don't really support this verbiage right now in AF_Sacrifice. It would need to be changed so if there are targets and you can't target players, a valid permanent needs to be targeted, and also Resolve would need to handle using the Targeted permanent as the sacrificee. After that it's just a SubAbility for a 5/5 Token for the TargetedController.

3rd Ability: "Each Dragon creature you control deals damage" I don't believe this supported right now either. We do have Repentance scripted, so maybe if the DamageSource returns multiple Sources, we just loop through the tgts and have multiple assignings of damage.

Code: Select all
        final ArrayList<Card> definedSources = AbilityFactory.getDefinedCards(saMe.getSourceCard(),
                params.get("DamageSource"), saMe);
        for (final Card source : definedSources){
            for (final Object o : tgts) {
Actually this doesn't quite work since each Dragon is capable of doing different amount of damage. The damage would need to be recalculated per Source. This area would need some additional code. If it was written in a more general manner, Wave of Reckoning might be scriptable after this work is completed.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: A guide to the AI of planeswalkers using ability factori

Postby slapshot5 » 05 Nov 2011, 04:24

friarsol wrote:3rd Ability: "Each Dragon creature you control deals damage" I don't believe this supported right now either. We do have Repentance scripted, so maybe if the DamageSource returns multiple Sources, we just loop through the tgts and have multiple assignings of damage.

Code: Select all
        final ArrayList<Card> definedSources = AbilityFactory.getDefinedCards(saMe.getSourceCard(),
                params.get("DamageSource"), saMe);
        for (final Card source : definedSources){
            for (final Object o : tgts) {
Actually this doesn't quite work since each Dragon is capable of doing different amount of damage. The damage would need to be recalculated per Source. This area would need some additional code. If it was written in a more general manner, Wave of Reckoning might be scriptable after this work is completed.
Yeah, I was looking at this. (Haven't done any code though.) Another trick is you can decide (per dragon) if it damages Player or gets redirected to the Planeswalker. We currently don't support this, so an EachDamage AF is at least as good as what we've got.

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: A guide to the AI of planeswalkers using ability factori

Postby jeffwadsworth » 05 Nov 2011, 06:01

The error is weird. Something about too many lines in the class, default is 150. Anyway, I will fool with it in the morning. Good to see the Tez script finally get added.
jeffwadsworth
Super Tester Elite
 
Posts: 1172
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 70 times

Re: A guide to the AI of planeswalkers using ability factori

Postby friarsol » 05 Nov 2011, 12:30

jeffwadsworth wrote:The error is weird. Something about too many lines in the class, default is 150. Anyway, I will fool with it in the morning. Good to see the Tez script finally get added.
That sounds like a checkstyle error/warning not a compile error. I'd say just delete the whole block.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: A guide to the AI of planeswalkers using ability factori

Postby slapshot5 » 06 Nov 2011, 02:27

Or, right-click on the project > Checkstyle > Deactivate. Problem solved.
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: A guide to the AI of planeswalkers using ability factori

Postby friarsol » 07 Nov 2011, 01:13

slapshot, did you make code changes in AF_Sacrifice to support the second ability? http://cardforge.org/bugz/view.php?id=543
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: A guide to the AI of planeswalkers using ability factori

Postby slapshot5 » 07 Nov 2011, 03:56

friarsol wrote:slapshot, did you make code changes in AF_Sacrifice to support the second ability? http://cardforge.org/bugz/view.php?id=543
Uhh, No, I don't think so. I swear I copied something for that. But, I don't see what that would have been in a current search. I'll revert until it can be done.

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: A guide to the AI of planeswalkers using ability factori

Postby friarsol » 07 Nov 2011, 04:07

slapshot5 wrote:
friarsol wrote:slapshot, did you make code changes in AF_Sacrifice to support the second ability? http://cardforge.org/bugz/view.php?id=543
Uhh, No, I don't think so. I swear I copied something for that. But, I don't see what that would have been in a current search. I'll revert until it can be done.

-slapshot5
I said up above it couldn't be scripted yet :-d
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 18 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 18 users online :: 0 registered, 0 hidden and 18 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: No registered users and 18 guests

Login Form