Forge version 1.5.28
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Forge version 1.5.28
by elcnesh » 27 Sep 2014, 09:37
That's possible – what kind of thing causes the card to be tapped in the first place? That effect probably misses an update call.
- elcnesh
- Posts: 290
- Joined: 16 May 2014, 15:11
- Location: Netherlands
- Has thanked: 34 times
- Been thanked: 92 times
Re: Forge version 1.5.28
by excessum » 27 Sep 2014, 13:27
It was a mistake on my part. I assumed that the Card.setTapped() in ManaCostAdjustment.adjustCostByConvoke() was correct when it should have been Card.tap() instead since tapping for Convoke should fire off "when tapped" events.elcnesh wrote:That's possible – what kind of thing causes the card to be tapped in the first place? That effect probably misses an update call.
Re: Forge version 1.5.28
by Agetian » 27 Sep 2014, 14:49
I committed this fix to trunk (replaced setTapped with tap in the relevant position).excessum wrote:It was a mistake on my part. I assumed that the Card.setTapped() in ManaCostAdjustment.adjustCostByConvoke() was correct when it should have been Card.tap() instead since tapping for Convoke should fire off "when tapped" events.elcnesh wrote:That's possible – what kind of thing causes the card to be tapped in the first place? That effect probably misses an update call.
- Agetian
- Agetian
- Programmer
- Posts: 3473
- Joined: 14 Mar 2011, 05:58
- Has thanked: 677 times
- Been thanked: 562 times
Re: Forge version 1.5.28
by Sloth » 27 Sep 2014, 22:17
I can confirm the following bug:
The UI should check for validity of the declaration of an attack before proceeding to the next step. I guess we need something similar to the validateBlocks function in CombatUtil.P for Pizza wrote:- Zurgo Helmsmasher, during attack declaration it starts attacking, but if you click on him, you can toggle off its attack. This should not be possible.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Forge version 1.5.28
by Agetian » 28 Sep 2014, 05:20
Sloth wrote:I can confirm the following bug:The UI should check for validity of the declaration of an attack before proceeding to the next step. I guess we need something similar to the validateBlocks function in CombatUtil.P for Pizza wrote:- Zurgo Helmsmasher, during attack declaration it starts attacking, but if you click on him, you can toggle off its attack. This should not be possible.
EDIT: Fixed as of r27721.
- Agetian
- Agetian
- Programmer
- Posts: 3473
- Joined: 14 Mar 2011, 05:58
- Has thanked: 677 times
- Been thanked: 562 times
Re: Forge version 1.5.28
by Phoenix » 28 Sep 2014, 07:24
Do you guys have any plans to integrate an in-game-updater?
That you have a compact core engine that calls the complete game engine. When you want to upgrade the game engine thread will be shut down and the core engine starts the update engine.
Then one had not to download the new version outside of the game.
That you have a compact core engine that calls the complete game engine. When you want to upgrade the game engine thread will be shut down and the core engine starts the update engine.
Then one had not to download the new version outside of the game.
Re: Forge version 1.5.28
by drdev » 28 Sep 2014, 07:58
Are you talking about something like the auto-update check the Android app has?Phoenix wrote:Do you guys have any plans to integrate an in-game-updater?
That you have a compact core engine that calls the complete game engine. When you want to upgrade the game engine thread will be shut down and the core engine starts the update engine.
Then one had not to download the new version outside of the game.
- drdev
- Programmer
- Posts: 1958
- Joined: 27 Jul 2013, 02:07
- Has thanked: 189 times
- Been thanked: 565 times
Re: Forge version 1.5.28
by Phoenix » 28 Sep 2014, 09:31
Since I don't use the Android app I just can guess that this is exactly what I'm talking about.
At the moment in my opinion for the PC version I only have the possibility to download the new version onto my PC, unpack the archive file, delete the old version (since I don't save into the same directory), and launch the new version.
An in-game auto-update would be much more comfortable.
At the moment in my opinion for the PC version I only have the possibility to download the new version onto my PC, unpack the archive file, delete the old version (since I don't save into the same directory), and launch the new version.
An in-game auto-update would be much more comfortable.
Re: Forge version 1.5.28
by Sloth » 28 Sep 2014, 10:12
This setup is normally fine, but causes some problems in corner cases. Example:Agetian wrote:Sloth wrote:I can confirm the following bug:The UI should check for validity of the declaration of an attack before proceeding to the next step. I guess we need something similar to the validateBlocks function in CombatUtil.P for Pizza wrote:- Zurgo Helmsmasher, during attack declaration it starts attacking, but if you click on him, you can toggle off its attack. This should not be possible.I can add to this observation that "X attacks each turn if able" seems to work fine (it's impossible to cancel it), e.g. on Juggernaut, but "X attacks each combat if able" (Zurgo Helmsmasher) is bugged the way described above (basically, can be turned off at will). Not sure, but maybe it's a simple enough fix if it's possible to make them both work the same way as far as "canceling" them goes?
EDIT: Fixed as of r27721.
I control a Master of Cruelties, another creature and Grand Melee. The Master of Cruelties and the other creature are declared as attackers and they actually attack together. This is against rule 508.1c. So in the long run a validateAttackers function is needed.
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Forge version 1.5.28
by Agetian » 28 Sep 2014, 14:30
Yes, agreed. I'm probably not the best person to write this, sadly, so if anyone can implement a function like that, help in this respect is more than welcome.
- Agetian
- Agetian
- Agetian
- Programmer
- Posts: 3473
- Joined: 14 Mar 2011, 05:58
- Has thanked: 677 times
- Been thanked: 562 times
Re: Forge version 1.5.28
by Sloth » 28 Sep 2014, 15:09
Here is another bug that i can confirm, but not fix immediately:
It looks like all the battalion triggers are broken, but normal attacks triggers work. That means that it fails to recognize the other attackers, when the trigger is run. Here is the relevant script of Wojek Halberdiers:fiend123 wrote:Wojek Halberdiers's battalion trigger doesn't trigger when I attack with it and 2 other creatures
- Wojek Halberdiers | Open
- T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | CheckSVar$ BattalionTest | NoResolvingCheck$ True | SVarCompare$ GE2 | Execute$ TrigBattalionPump | TriggerDescription$ Battalion - Whenever CARDNAME and at least two other creatures attack, CARDNAME gains first strike until end of turn.
SVar:TrigBattalionPump:AB$ Pump | Cost$ 0 | KW$ First Strike | Defined$ Self
SVar:BattalionTest:Count$Valid Creature.attacking+Other
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Forge version 1.5.28
by drdev » 28 Sep 2014, 15:52
I just fixed Charms so they display properly on the Android app. To prevent such an issue happening again with the use of special characters, please be sure to use the unicode representation (\u####) and check that that unicode character is also included in FSkinFont::generateFont in forge-gui-mobile on this line:
String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890\"!?'.,;:()[]{}<>|/@\\^$-%+=#_&*\u2014\u2022";
String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890\"!?'.,;:()[]{}<>|/@\\^$-%+=#_&*\u2014\u2022";
- drdev
- Programmer
- Posts: 1958
- Joined: 27 Jul 2013, 02:07
- Has thanked: 189 times
- Been thanked: 565 times
Re: Forge version 1.5.28
by KrazyTheFox » 28 Sep 2014, 16:00
Ah, thanks! I was actually about to go look into that myself. The HTML characters were the only ones that seemed to work on the desktop version when I added it, though I can't recall if I actually tried unicode. I'll definitely keep this in mind for future updates.drdev wrote:I just fixed Charms so they display properly on the Android app. To prevent such an issue happening again with the use of special characters, please be sure to use the unicode representation (\u####) and check that that unicode character is also included in FSkinFont::generateFont in forge-gui-mobile on this line:
String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890\"!?'.,;:()[]{}<>|/@\\^$-%+=#_&*\u2014\u2022";
-
KrazyTheFox - Programmer
- Posts: 725
- Joined: 18 Mar 2014, 23:51
- Has thanked: 66 times
- Been thanked: 226 times
Re: Forge version 1.5.28
by Agetian » 29 Sep 2014, 02:42
I tried tracking through the relevant code here but couldn't find what exactly failed - the game seems to do the math correctly (figuring out that there are 2 other attacking creatures), makes the correct comparison against GE2 (e.g. in case of Legion Loyalist which I used as a test case) and then goes through a rather convoluted set of calls which, for some reason, amount to no trigger being actually registered I'm afraid I won't be able to tackle this one either, please assist if someone knows how to fix this (it doesn't break too many cards but it breaks a whole mechanic with a good enough deal of Modern-legal cards in order for it to be relevant).Sloth wrote:Here is another bug that i can confirm, but not fix immediately:It looks like all the battalion triggers are broken, but normal attacks triggers work. That means that it fails to recognize the other attackers, when the trigger is run. Here is the relevant script of Wojek Halberdiers:fiend123 wrote:Wojek Halberdiers's battalion trigger doesn't trigger when I attack with it and 2 other creatures
- Wojek Halberdiers | Open
- T:Mode$ Attacks | ValidCard$ Card.Self | TriggerZones$ Battlefield | CheckSVar$ BattalionTest | NoResolvingCheck$ True | SVarCompare$ GE2 | Execute$ TrigBattalionPump | TriggerDescription$ Battalion - Whenever CARDNAME and at least two other creatures attack, CARDNAME gains first strike until end of turn.
SVar:TrigBattalionPump:AB$ Pump | Cost$ 0 | KW$ First Strike | Defined$ Self
SVar:BattalionTest:Count$Valid Creature.attacking+Other
- Agetian
- Agetian
- Programmer
- Posts: 3473
- Joined: 14 Mar 2011, 05:58
- Has thanked: 677 times
- Been thanked: 562 times
Re: Forge version 1.5.28
by Agetian » 29 Sep 2014, 16:53
Ok, in continuation of my efforts to figure out what is causing Battalion not to work in the current builds, I have at least identified the spot where it's failing and I have found what may potentially restore this functionality, albeit I have not found a way to make it work in such a way that will not break anything else. That's why I'm not committing this to SVN obviously (it's not a real "fix").
Anyhow, the problem seems to be in CombatUtil.checkDeclaredAttacker (or at least some related code) - the "Attacks" trigger for Battalion does not register correctly in CombatUtil.checkDeclaredAttacker, which causes the Battalion trigger not to fire.
In particular, line 946 that calls runTrigger (with mode=Attacks) seems to do nothing - it adds a waiting trigger but that waiting trigger never fires.
Adding this line:
I hope this little investigation will at least shed some light onto what may be failing and where to look for the potential places to fix.
EDIT: Making the following change in addition to what is done above appears to both fix Battalion *and* avoid duplication of registration of Attacks triggers for everything else, but it feels super hacky and most likely breaks something else somewhere (especially if registering the same trigger two or more times is actually viable in some circumstances - note that this does not include cases when the same card trigger multiple times in a row, such as Deathgreeter after Wrath of God, these cards still trigger correctly, once for each card that makes its trigger fire [e.g. four times if four creatures die at once]).
A better fix is still needed, so consider this change just a "meditation" on what the possible locations of importance are for the Battalion mechanic.
Line 206 in TriggerHandler.java:
- Agetian
Anyhow, the problem seems to be in CombatUtil.checkDeclaredAttacker (or at least some related code) - the "Attacks" trigger for Battalion does not register correctly in CombatUtil.checkDeclaredAttacker, which causes the Battalion trigger not to fire.
In particular, line 946 that calls runTrigger (with mode=Attacks) seems to do nothing - it adds a waiting trigger but that waiting trigger never fires.
Adding this line:
- Code: Select all
game.getTriggerHandler().registerActiveTrigger(c, false);
- Code: Select all
game.getTriggerHandler().runTrigger(TriggerType.Attacks, runParams, false);
I hope this little investigation will at least shed some light onto what may be failing and where to look for the potential places to fix.
EDIT: Making the following change in addition to what is done above appears to both fix Battalion *and* avoid duplication of registration of Attacks triggers for everything else, but it feels super hacky and most likely breaks something else somewhere (especially if registering the same trigger two or more times is actually viable in some circumstances - note that this does not include cases when the same card trigger multiple times in a row, such as Deathgreeter after Wrath of God, these cards still trigger correctly, once for each card that makes its trigger fire [e.g. four times if four creatures die at once]).
A better fix is still needed, so consider this change just a "meditation" on what the possible locations of importance are for the Battalion mechanic.
Line 206 in TriggerHandler.java:
- Code: Select all
if (isTriggerActive(t) && !activeTriggers.contains(t)) {
- Agetian
- Agetian
- Programmer
- Posts: 3473
- Joined: 14 Mar 2011, 05:58
- Has thanked: 677 times
- Been thanked: 562 times
Who is online
Users browsing this forum: No registered users and 35 guests