It is currently 24 Apr 2024, 01:02
   
Text Size

The Rack damage is reversed

Post MTG Forge Related Programming Questions Here

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

The Rack damage is reversed

Postby Farnsworth » 20 Jul 2014, 13:30

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.
Farnsworth
 
Posts: 5
Joined: 20 Jul 2014, 03:11
Has thanked: 0 time
Been thanked: 0 time

Re: The Rack damage is reversed

Postby friarsol » 21 Jul 2014, 01:52

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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: The Rack damage is reversed

Postby Farnsworth » 21 Jul 2014, 02:05

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.
Farnsworth
 
Posts: 5
Joined: 20 Jul 2014, 03:11
Has thanked: 0 time
Been thanked: 0 time

Re: The Rack damage is reversed

Postby Farnsworth » 21 Jul 2014, 15:11

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.
Farnsworth
 
Posts: 5
Joined: 20 Jul 2014, 03:11
Has thanked: 0 time
Been thanked: 0 time


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 64 guests


Who is online

In total there are 64 users online :: 0 registered, 0 hidden and 64 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 64 guests

Login Form