Clicktoplaycontroller buv
Guest
|
Legend
Aug 23, 2018 5:59:35 GMT
via mobile
Post by Clicktoplaycontroller buv on Aug 23, 2018 5:59:35 GMT
Hey I actuay ran into this a while ago and not sure I mentioned it..I got side tracked so never fixed it...but when you click to play a card that has a manual target and DoubleClick IT instead of a card to select...it plays the card and I don't think it plays the effect....anyone else see this occur?
I'll try to look at clicktoplay to see what's causing it when I get the chance
What's cool about this design...are the lack of bugs I find even when I add a bunch of code just cause it's so laid out well!
|
|
|
Legend
Aug 23, 2018 14:47:01 GMT
Post by Admin on Aug 23, 2018 14:47:01 GMT
Glad you like the code and its working for you!
Regarding the bug, it sounds familiar... did you already finish the whole series? Because I know I fixed some bugs around targeting in the lesson “Spell & Abilities” – check out the section header “More Refactoring”.
|
|
dd
New Member
Posts: 5
|
Legend
Aug 23, 2018 19:13:05 GMT
Post by dd on Aug 23, 2018 19:13:05 GMT
Here is a gif of the issue - its from the CCG 19 JSON - i compared the spells and abilities refactoring and dont see anything missed in the scripts Attachments:
|
|
|
Legend
Aug 27, 2018 14:21:22 GMT
Post by Admin on Aug 27, 2018 14:21:22 GMT
Thanks for the gif, I can confirm that I see the same issue. Here's what is happening...
In the "ClickToPlayCardController", when you click off of the manual targeted card, it goes back to the hand so you can see the board better and make it easier to actually select a target. This is the "ShowTargetState" state. It looks similar to what happens when you deselect a card, so that could be a bit confusing, and it would probably help if we added a different position off to the side or something.
The next time you click, it assigns the selection (null in this case) and completes the flow via ConfirmState etc. The logic for determining the validity of a target should exists in the TargetSystem. The TargetSystem is permitting this spell to play because of the way that it is defined. The card's target's "required" flag will be false because I forgot to implement it. If you add something like this to the "Card10"'s "target" body:
"required": true,
And add something like this to the DeckFactory:
if (targetData.ContainsKey("required")) { target.required = Convert.ToBoolean(targetData["required"]); }
Then you should be able to fix this bug. Hope that helps!
|
|
dd
New Member
Posts: 5
|
Legend
Aug 29, 2018 5:06:53 GMT
Post by dd on Aug 29, 2018 5:06:53 GMT
confirmed this works thanks alot!
|
|