Page 1 of 1

The Rack damage is reversed

PostPosted: 20 Jul 2014, 13:30
by Farnsworth
Hello. I stumbled across Forge a couple days ago when looking into programming an AI for a card game I was writing. After playing around with Forge for a while I thought it would be a fun project to help out with. I am specifically interested in working on the AI, but I thought I'd fix some bugs first. I found an issue with The Rack, where it wasn't dealing damage. It seems that instead of subtracting 3 from your hand size, it was doing 3 minus your hand size. Here is my change

Original | Open
Name:The Rack
ManaCost:1
Types:Artifact
K:ETBReplacement:Other:ChooseP
SVar:ChooseP:DB$ ChoosePlayer | Defined$ You | Choices$ Player.Opponent | AILogic$ Curse | SpellDescription$ As CARDNAME enters the battlefield, choose an opponent.
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player.Chosen | TriggerZones$ Battlefield | Execute$ TrigDamage | TriggerDescription$ At the beginning of the chosen player's upkeep, CARDNAME deals X damage to that player, where X is 3 minus the number of cards in his or her hand.
SVar:TrigDamage:AB$ DealDamage | Cost$ 0 | Defined$ ChosenPlayer | NumDmg$ X | References$ X
SVar:X:Count$InChosenHand/NMinus.3
Oracle:As The Rack enters the battlefield, choose an opponent.\nAt the beginning of the chosen player's upkeep, The Rack deals X damage to that player, where X is 3 minus the number of cards in his or her hand.


Modified | Open
Name:The Rack
ManaCost:1
Types:Artifact
K:ETBReplacement:Other:ChooseP
SVar:ChooseP:DB$ ChoosePlayer | Defined$ You | Choices$ Player.Opponent | AILogic$ Curse | SpellDescription$ As CARDNAME enters the battlefield, choose an opponent.
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ Player.Chosen | TriggerZones$ Battlefield | Execute$ TrigDamage | TriggerDescription$ At the beginning of the chosen player's upkeep, CARDNAME deals X damage to that player, where X is 3 minus the number of cards in his or her hand.
SVar:TrigDamage:AB$ DealDamage | Cost$ 0 | Defined$ ChosenPlayer | NumDmg$ X | References$ X
SVar:X:Count$InChosenHand/Minus.3
Oracle:As The Rack enters the battlefield, choose an opponent.\nAt the beginning of the chosen player's upkeep, The Rack deals X damage to that player, where X is 3 minus the number of cards in his or her hand.

Re: The Rack damage is reversed

PostPosted: 21 Jul 2014, 01:52
by friarsol
Farnsworth wrote: It seems that instead of subtracting 3 from your hand size, it was doing 3 minus your hand size.
You might want to re-read the card.

"At the beginning of the chosen player's upkeep, The Rack deals X damage to that player, where X is 3 minus the number of cards in his or her hand."

3-X = Damage. So 0 cards is 3 damage. >2 cards is no damage.

Re: The Rack damage is reversed

PostPosted: 21 Jul 2014, 02:05
by Farnsworth
That's awkward :oops:. The card seems a lot more reasonable now. One other thing that arose when I was going through this, I kept getting an error log that said "X is not a valid reference, falling back to card". Is this something that is supposed to be happening? It seems weird to log if it's an expected use case.

Re: The Rack damage is reversed

PostPosted: 21 Jul 2014, 15:11
by Farnsworth
So this time, I fixed a bug that's actually a bug, issue #0000762 on cardforge.org (can't link sorry). Grudge Keeper should only trigger when it's on the battlefield.

Original | Open
Code: Select all
Name:Grudge Keeper
ManaCost:1 B
Types:Creature Zombie Wizard
PT:2/1
T:Mode$ Vote | Execute$ TrigLoseLife | TriggerDescription$ Whenever players finish voting, each opponent who voted for a choice you didn't vote for loses 2 life.
SVar:TrigLoseLife:AB$ LoseLife | Cost$ 0 | Defined$ TriggeredOtherVoters | LifeAmount$ 2
Oracle:Whenever players finish voting, each opponent who voted for a choice you didn't vote for loses 2 life.
Modified | Open
Code: Select all
Name:Grudge Keeper
ManaCost:1 B
Types:Creature Zombie Wizard
PT:2/1
T:Mode$ Vote | Execute$ TrigLoseLife | TriggerZones$ Battlefield | TriggerDescription$ Whenever players finish voting, each opponent who voted for a choice you didn't vote for loses 2 life.
SVar:TrigLoseLife:AB$ LoseLife | Cost$ 0 | Defined$ TriggeredOtherVoters | LifeAmount$ 2
Oracle:Whenever players finish voting, each opponent who voted for a choice you didn't vote for loses 2 life.