Board index
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk
How to correctly skip a combat phase?
Moderator: CCGHQ Admins
1 post
• Page 1 of 1
How to correctly skip a combat phase?
by thefiremind » 17 Nov 2012, 13:17
As I noticed in DotP2012, if a player can't attack with anything, in DotP games his combat phase is skipped. This would mean that giving a player PLAYER_CHARACTERISTIC_CANT_ATTACK at the end of main phase 1 and lifting the restriction "afterwards" (more on this later) is totally equivalent to skipping that player's combat phase. But it's not so easy as it seems.
First problem: skipping "next" phases, as well as skipping "next" turns or taking extra turns, are cumulative. So 2 Stonehorn Dignitary played in the same turn can make a player skip his next 2 combat phases. This problem can be solved by using a register in the players' data chests that keeps track of the combat phases to skip. The effect of skipping a combat phase could increment the register and then set a delayed trigger that triggers when the register is set to that same number, and decrements it. So, for example:
Second problem (suggestions appreciated): let's pretend that my opponent has Finest Hour, and I Cloudshift my Stonehorn Dignitary during his first combat phase. Finest Hour triggers, now there should be 2 combat phases in a row, but the second should be skipped. How can I "intercept" it? Firing the delayed trigger at the end of main phase 1 doesn't work in this case.
I could fire it at the next end of phase of that player's turn, no matter which phase it will be... would this have bad side effects?
Third problem (suggestions appreciated on this as well): remember that "afterwards" I wrote earlier? When should I lift the PLAYER_CHARACTERISTIC_CANT_ATTACK restriction? There's no end of combat because the combat phase will be skipped, and there's probably (I'm almost sure) no main phase 2 because the game won't put 2 main phases in a row (it would be meaningless). It would seem natural to lift the restriction at the beginning of the end phase... but what if I play Relentless Assault on main phase 1, and I have to skip a combat phase? Only the combat phase granted by Relentless Assault should be skipped... can I lift the restriction early enough to go through the regular combat phase?
First problem: skipping "next" phases, as well as skipping "next" turns or taking extra turns, are cumulative. So 2 Stonehorn Dignitary played in the same turn can make a player skip his next 2 combat phases. This problem can be solved by using a register in the players' data chests that keeps track of the combat phases to skip. The effect of skipping a combat phase could increment the register and then set a delayed trigger that triggers when the register is set to that same number, and decrements it. So, for example:
- I play a Stonehorn Dignitary: the register increments to 1 and the delayed trigger will be fired when the register is equal to 1
- I play another Stonehorn Dignitary: the register increments to 2 and the delayed trigger will be fired when the register is equal to 2
- My opponent goes through his turn: the last trigger fires because the register is equal to 2, he skips his combat phase, the register is decremented to 1
- (My turn isn't important, I don't play another Stonehorn Dignitary)
- My opponent goes through another turn: the first trigger fires because the register is equal to 1, he skips his combat phase, the register is decremented to 0
Second problem (suggestions appreciated): let's pretend that my opponent has Finest Hour, and I Cloudshift my Stonehorn Dignitary during his first combat phase. Finest Hour triggers, now there should be 2 combat phases in a row, but the second should be skipped. How can I "intercept" it? Firing the delayed trigger at the end of main phase 1 doesn't work in this case.
I could fire it at the next end of phase of that player's turn, no matter which phase it will be... would this have bad side effects?
Third problem (suggestions appreciated on this as well): remember that "afterwards" I wrote earlier? When should I lift the PLAYER_CHARACTERISTIC_CANT_ATTACK restriction? There's no end of combat because the combat phase will be skipped, and there's probably (I'm almost sure) no main phase 2 because the game won't put 2 main phases in a row (it would be meaningless). It would seem natural to lift the restriction at the beginning of the end phase... but what if I play Relentless Assault on main phase 1, and I have to skip a combat phase? Only the combat phase granted by Relentless Assault should be skipped... can I lift the restriction early enough to go through the regular combat phase?
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-

thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 722 times
1 post
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 11 guests