It is currently 29 Oct 2025, 12:27
   
Text Size

MustBeBlocked

Post MTG Forge Related Programming Questions Here

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

MustBeBlocked

Postby moomarc » 25 Jan 2012, 18:04

@Sloth: Thanks for adding the MustBeBlocked code. Already makes the AI seem a bit smarter :wink:

Anyway, I was just wandering how big a stretch it is to expand this for the "CARDNAME must be blocked if able" keyword. I'm guessing a lot more difficult than it would appear to non-coders like me? I guess the AI logic is the really difficult part?

There's the 2 Dark Ascension cards that use it, as well as Goblin Fire Fiend, Inescapable Brute and Irresistable Prey, (as well as Nacatl War-Pride if its expanded to specify the number of mandatory blockers).
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: MustBeBlocked

Postby Sloth » 25 Jan 2012, 21:37

I thought about this keyword today too.

It's not only the AI part that's difficult, combat involving creatures with "CARDNAME must be blocked if able.", "CARDNAME blocks each turn if able." and "All creatures able to block CARDNAME do so." combined with "CARDNAME can't be blocked except by two or more creatures." and "CARDNAME can't be blocked by more than one creature." can lead to situations were a legal block is hard to check.

Ruleswise every possible blocking constalation has to be checked for how many restrictions and requirements they abide by. Only the best are legal.

That's also the reason why "CARDNAME can't be blocked except by three or more creatures." is not implemented yet. That said i will continue to think about it and maybe i find an easy solution.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: MustBeBlocked

Postby friarsol » 26 Jan 2012, 01:28

The blocking is uhh super aggressive now. I thought it was just a small change making trading up much more likely (blocking my 3/1 pet with a 1/1) instead of taking damage. But it seems like the AI now is blocking even in situations where the blocker dies but not the attacker, even if his life is at stake, or he has tons of chump blockers.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: MustBeBlocked

Postby moomarc » 26 Jan 2012, 06:13

friarsol wrote:The blocking is uhh super aggressive now. I thought it was just a small change making trading up much more likely (blocking my 3/1 pet with a 1/1) instead of taking damage. But it seems like the AI now is blocking even in situations where the blocker dies but not the attacker, even if his life is at stake, or he has tons of chump blockers.
I think that's the general isea. If you look at the cards that the svar's been applied to, they all have considerably worse effects if they go unblocked (except Cabal Executioner perhaps seeing as there's some relatively fleshed out AI logic for choosing what to select and might even have good consequences in decks that use SacrificeMe cards). Maybe it just needs to be fleshed out by adding an 'unless' or 'unless present' clause somehow. Then Throat Slitter could instead read something like SVar:MustBeBlocked:Creature.nonBlack+YouCtrl:EQ0:True. But I'm just dreaming from a non-coder's point of view so could be completely unreasonable.
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: MustBeBlocked

Postby friarsol » 26 Jan 2012, 13:05

Marc, I think you misunderstood me. ALL of my creatures are treated as if they must be blocked, including my 3/1 Crocodile Pet. The check for this SVar might be inverted, or maybe returning true all the time.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: MustBeBlocked

Postby moomarc » 26 Jan 2012, 13:38

Ah. Understood! Can see how that could be a problem :shock:
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 13 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 13 users online :: 0 registered, 0 hidden and 13 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 13 guests

Login Form