Bug Reports (snapshot builds)
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Bug Reports (snapshot builds)
by Agetian » 20 Dec 2016, 06:54
Ok, I'm investigating the issue with Gisela, Blade of Goldnight not working with lifelink, and it looks like the problem is that we have a separate path for handling combat and non-combat lifelink, and combat lifelink is not handled correctly for combat damage that is replaced elsewhere (basically, the "lifelink" combat damage is already set to 0 at that point because it's replaced, and the replacement damage does not count as lifelink because the game thinks that lifelink was already handled elsewhere - see addDamageAfterPrevention in both Player.java and Card.java). Is there a particular reason it was implemented that way, with two separate paths for lifelink?
Handling both combat and non-combat lifelink in addDamageAfterPrevention in both Player and Card (and removing a separate path for combat lifelink in Combat) solves this problem and the basic test cases seem to work fine (lifelink combat damage to card and to player, replaced combat damage to card and to player), but I have a strange suspicion that the original implementation probably accounted for some trigger timing or something like that, and that can get screwed up if that separation between combat and non-combat damage is removed.
Any advice on this one? Thanks in advance for help!
- Agetian
Handling both combat and non-combat lifelink in addDamageAfterPrevention in both Player and Card (and removing a separate path for combat lifelink in Combat) solves this problem and the basic test cases seem to work fine (lifelink combat damage to card and to player, replaced combat damage to card and to player), but I have a strange suspicion that the original implementation probably accounted for some trigger timing or something like that, and that can get screwed up if that separation between combat and non-combat damage is removed.
Any advice on this one? Thanks in advance for help!
- Agetian
- Agetian
- Programmer
- Posts: 3487
- Joined: 14 Mar 2011, 05:58
- Has thanked: 683 times
- Been thanked: 569 times
Re: Bug Reports (snapshot builds)
by Hanmac » 20 Dec 2016, 07:12
not much of an Advice, but while you are there about Damage Prevention and Redirection, we might look at "prevent the next X damage" effects done with Replacement.
when you are dealt damage from multiple sources at the same time, you can't choose from which one you want to prevent.
PS:
i am currently try to do TokenDoubler as ReplacementEffect, but there i might need help too.
when you are dealt damage from multiple sources at the same time, you can't choose from which one you want to prevent.
PS:
i am currently try to do TokenDoubler as ReplacementEffect, but there i might need help too.
Re: Bug Reports (snapshot builds)
by Agetian » 20 Dec 2016, 07:17
This would be very good to implement, though I'm not sure I'll be able to immediately find enough time to look into thatHanmac wrote:not much of an Advice, but while you are there about Damage Prevention and Redirection, we might look at "prevent the next X damage" effects done with Replacement.
when you are dealt damage from multiple sources at the same time, you can't choose from which one you want to prevent.

Good luck with the token doubling! I don't know if I can be much of help in that department, but I can always test stuff if needed.

- Agetian
- Agetian
- Programmer
- Posts: 3487
- Joined: 14 Mar 2011, 05:58
- Has thanked: 683 times
- Been thanked: 569 times
Re: Bug Reports (snapshot builds)
by Agetian » 20 Dec 2016, 08:46
I submitted the solution in r32746, but please keep an eye open for potential trouble coming from the fact that combat and non-combat lifelink are now handled in the same place instead of in the different spots they were handled in before. Not sure what that may break, but I have a feeling that there was some kind of an intention behind that design. The basic tests (for both combat and non-combat lifelink, replaced and non-replaced) pass though.Gallant Crow wrote:- With Gisela, Blade of Goldnight in play, Baneslayer Angel's lifelink doesn't work (any lifelink I guess).
This affects specifically cards that have X dependent on something else other than the amount of mana paid (X:Count$xPaid), in case of Detonate it's the CMC of the target artifact. I submitted a hacky solution in r32747-32748 that changes the legal targets of Detonate to zero CMC Artifacts (X=0) if the spell is cast without mana cost, but ideally this should be done via Announce$ X by allowing the user to specify X before starting to target and cast the spell *or* force-setting the announced X to 0 if the spell is cast without mana cost. I was roughly successful with that approach but sadly that caused the AI to stop casting the spell altogether on anything but artifacts with CMC 0, and I couldn't find the solution. :/ Help is welcome.
I fixed this in r32745.Gallant Crow wrote:- Sometimes Wild Evocation does not work properly, for instance, the AI player revealed Chandra's Ignition and had legal targets for it, but for some reason didn't cast it.
Can't figure out why Sidisi won't let the player find a card in the library when exploiting itself in the presence of a ReplaceMoved effect yet (e.g. Kalitas), but it's definitely not related to my change in ReplaceMoved (tried without it and Sidisi still won't search :/ ).
Also, no idea why the game won't let the player choose the kicker additional cost when casting a spell without paying its mana cost

- Agetian
- Agetian
- Programmer
- Posts: 3487
- Joined: 14 Mar 2011, 05:58
- Has thanked: 683 times
- Been thanked: 569 times
Re: Bug Reports (snapshot builds)
by Hanmac » 20 Dec 2016, 09:21
I think the lifelink thing was done for a reason (by me), that it only cause the Player to gain once life if a creature with lifelink does hit multiple creatures.
Re: Bug Reports (snapshot builds)
by Agetian » 20 Dec 2016, 10:19
Hmm, ok, I'll revert it for now then and will try to think of something else. This is going to be a rather difficult fix though, since by the time addDamageAfterPrevention is called, the game has no memory of the fact that the original damage was replaced. :/Hanmac wrote:I think the lifelink thing was done for a reason (by me), that it only cause the Player to gain once life if a creature with lifelink does hit multiple creatures.
- Agetian
- Agetian
- Programmer
- Posts: 3487
- Joined: 14 Mar 2011, 05:58
- Has thanked: 683 times
- Been thanked: 569 times
Re: Bug Reports (snapshot builds)
by Agetian » 20 Dec 2016, 13:24
r32749: I found a very annoying bug with Waxmane Baku.
The AI probably does not understand the "remove counter" cost properly, and it keeps pouring all available mana at the beginning of each turn into it, each time with X=0 and not targeting anything (even when Waxmane Baku has no Ki counters on it to remove at all). It both makes the AI operate at a terrible disadvantage and annoys the human player by repeatedly activating this ability without any reason whatsoever. After some more testing, it looks like the AI will repeatedly activate the ability with X=0 and pour all available mana into it if the Waxmane Baku has no Ki counters on it. If it does have counters, the AI will typically just ignore the ability and not use it at all.
EDIT: Tried to fix this with r32750. There is still some quite wonky logic where the AI will only consider SubCounter with X in its mana cost when its life is in danger (probably can be eventually improved for cards like Blademane Baku which can be used offensively to finish off the player if there are enough counters for lethal damage), but at least it won't lose all the mana and annoy the player with repeated silly activations anymore.
- Agetian
The AI probably does not understand the "remove counter" cost properly, and it keeps pouring all available mana at the beginning of each turn into it, each time with X=0 and not targeting anything (even when Waxmane Baku has no Ki counters on it to remove at all). It both makes the AI operate at a terrible disadvantage and annoys the human player by repeatedly activating this ability without any reason whatsoever. After some more testing, it looks like the AI will repeatedly activate the ability with X=0 and pour all available mana into it if the Waxmane Baku has no Ki counters on it. If it does have counters, the AI will typically just ignore the ability and not use it at all.
EDIT: Tried to fix this with r32750. There is still some quite wonky logic where the AI will only consider SubCounter with X in its mana cost when its life is in danger (probably can be eventually improved for cards like Blademane Baku which can be used offensively to finish off the player if there are enough counters for lethal damage), but at least it won't lose all the mana and annoy the player with repeated silly activations anymore.

- Agetian
- Agetian
- Programmer
- Posts: 3487
- Joined: 14 Mar 2011, 05:58
- Has thanked: 683 times
- Been thanked: 569 times
Re: Bug Reports (snapshot builds)
by Agetian » 20 Dec 2016, 16:20
A deck editor bug: it's possible to add more than 4 copies of the same card if you add cards from different editions (basically, it allows 4 copies of each card per edition - e.g. you can have 4 Aether Adepts from one edition and then add 4 Aether Adepts from a different edition).
If the game enforces deck conformance you'll not be allowed to play this deck afterwards, but it's weird to then be allowed to add more than the limit anyway.
EDIT: fixed (r32751).
- Agetian
If the game enforces deck conformance you'll not be allowed to play this deck afterwards, but it's weird to then be allowed to add more than the limit anyway.
EDIT: fixed (r32751).
- Agetian
Last edited by Agetian on 20 Dec 2016, 17:05, edited 1 time in total.
- Agetian
- Programmer
- Posts: 3487
- Joined: 14 Mar 2011, 05:58
- Has thanked: 683 times
- Been thanked: 569 times
Re: Bug Reports (snapshot builds)
by Agetian » 20 Dec 2016, 16:30
Well, sadly I can't figure out what to do with Lifelink when the combat damage is replaced via ReplaceDamage.
The thing is, it's currently quite broken and even acts differently (and inconsistently) when the damage is dealt to a permanent or to a player. To wit:
* If a lifelink creature deals damage to a player while Gisela, Blade of Goldnight is in play, then double damage is dealt to the player, but no life gain happens at all (the damage is treated at 0 in Combat::dealAssignedDamage).
* If a lifelink creature deals damage to a permanent (creature) while Gisela, Blade of Goldnight is in play, then double damage is dealt to the creature, the life gain happens as well, but only as if the damage dealt was not double (for example, Baneslayer Angel would deal 10 damage to the creature, and the player would gain 5 life from lifelink).
Not sure how to best approach fixing this without breaking other stuff. :/
- Agetian
The thing is, it's currently quite broken and even acts differently (and inconsistently) when the damage is dealt to a permanent or to a player. To wit:
* If a lifelink creature deals damage to a player while Gisela, Blade of Goldnight is in play, then double damage is dealt to the player, but no life gain happens at all (the damage is treated at 0 in Combat::dealAssignedDamage).
* If a lifelink creature deals damage to a permanent (creature) while Gisela, Blade of Goldnight is in play, then double damage is dealt to the creature, the life gain happens as well, but only as if the damage dealt was not double (for example, Baneslayer Angel would deal 10 damage to the creature, and the player would gain 5 life from lifelink).
Not sure how to best approach fixing this without breaking other stuff. :/
- Agetian
- Agetian
- Programmer
- Posts: 3487
- Joined: 14 Mar 2011, 05:58
- Has thanked: 683 times
- Been thanked: 569 times
Re: Bug Reports (snapshot builds)
by tullerr » 20 Dec 2016, 18:51
Description: I was playing quest mode. It crashes whenever i click "great!" after winning a duel or when I click the "challanges" window... any help would be great
- NullPointerException | Open
- Code: Select all
Forge Version: 1.5.56-r-1
Operating System: Windows 7 6.1 x86
Java Version: 1.8.0_111 Oracle Corporation
java.lang.NullPointerException
at forge.screens.home.quest.PnlEvent.<init>(PnlEvent.java:49)
at forge.screens.home.quest.CSubmenuChallenges.update(CSubmenuChallenges.java:166)
at forge.screens.home.CHomeUI.itemClick(CHomeUI.java:53)
at forge.screens.home.LblMenuItem$1.mousePressed(LblMenuItem.java:45)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
- tullerr
- Posts: 1
- Joined: 20 Dec 2016, 18:24
- Has thanked: 0 time
- Been thanked: 0 time
Re: Bug Reports (snapshot builds)
by Agetian » 20 Dec 2016, 19:16
You're on a rather old snapshot. This issue has already been addressed in newer trunk builds.tullerr wrote:Description: I was playing quest mode. It crashes whenever i click "great!" after winning a duel or when I click the "challanges" window... any help would be great
- NullPointerException | Open
- Code: Select all
Forge Version: 1.5.56-r-1
Operating System: Windows 7 6.1 x86
Java Version: 1.8.0_111 Oracle Corporation
java.lang.NullPointerException
at forge.screens.home.quest.PnlEvent.<init>(PnlEvent.java:49)
at forge.screens.home.quest.CSubmenuChallenges.update(CSubmenuChallenges.java:166)
at forge.screens.home.CHomeUI.itemClick(CHomeUI.java:53)
at forge.screens.home.LblMenuItem$1.mousePressed(LblMenuItem.java:45)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
- Agetian
- Agetian
- Programmer
- Posts: 3487
- Joined: 14 Mar 2011, 05:58
- Has thanked: 683 times
- Been thanked: 569 times
Re: Bug Reports (snapshot builds)
by Agetian » 20 Dec 2016, 19:18
This appears to be a visual issue, for some reason CardFactoryUtil::xCount is returning a wrong number for X upon count when called from SpellAbilityEffect.java:105.
EDIT: fixed (r32752).
- Agetian
- Agetian
- Programmer
- Posts: 3487
- Joined: 14 Mar 2011, 05:58
- Has thanked: 683 times
- Been thanked: 569 times
Re: Bug Reports (snapshot builds)
by stormcat » 20 Dec 2016, 21:55
Grenzo, Havoc Raiser's ability is not correctly working.
Please refer to attachments.
In spite of I dealt combat damage to two player, Grenzo's ability can only target a creature controled by one player.
And window of choosing ability mode is inconvenience.
I don't know which creature triggered it.
Please refer to attachments.
In spite of I dealt combat damage to two player, Grenzo's ability can only target a creature controled by one player.
And window of choosing ability mode is inconvenience.
I don't know which creature triggered it.
Re: Bug Reports (snapshot builds)
by disferente » 21 Dec 2016, 12:03
Amoeboid Changeling, when cloned by Progenitor Mimic does note get the benefit of having Changeling ability.
Version 1.5.58.006
Android
Version 1.5.58.006
Android
- disferente
- Posts: 11
- Joined: 21 Dec 2016, 11:50
- Has thanked: 0 time
- Been thanked: 1 time
Who is online
Users browsing this forum: No registered users and 43 guests