这是我移除玩家卡并将其添加到弃牌堆的通用子。然后生成一个数字并代表我的数量整数数组中的一张卡片。
此处的抓取变量表示正在播放的抓取卡中的值,然后防守方可以防御抓取,然后如果他们同时拥有阻挡和抓取,则可以抓住进攻方。我的代码中的从 1 到 3 的变量代表了该过程中的不同步骤。Grab 1 逻辑将其设置为移除防御者阻挡卡。Grab 2 移除防守者的抢牌, Grab 3 移除违规者的抢牌。
抓取 1 或移除块卡可以正常工作,以及抓取 3。但是由于某种原因,抓取 2 无法正常工作。取而代之的是,它替换了该块两次的卡槽。Grab 1 移除了块,并且出于某种原因,grab 2 正在移除替换。
Private Sub GrabFromDeckAndDiscard()
'ReDeclare CheckBox Array for Private sub
Dim CardCheckBoxArray() As CheckBox = {CardCheckBox1, CardCheckBox2, CardCheckBox3, CardCheckBox4, CardCheckBox5}
CardCheckBoxArray(NumberArrayStorageForSpecialCards Mod 5).Checked = False
If Grab = 1 Then
'set checks to the number in the number array set for block
Checks = DodgeBlockDisarmDialog.CheckGrabs
ElseIf Grab = 2 Then
'set checks to the number in the number array set for grab
GrabGone = (T * 5)
Do Until GrabGone = (T * 5) + 4 Or Player1HandGroup(NumberArray(GrabGone)).ID = 19
MsgBox(GrabGone)
If Player1HandGroup(NumberArray(GrabGone)).CardNameString = "Grab" Then
Checks = GrabGone
End If
GrabGone += 1
Loop
ElseIf Grab = 3 Then
'set checks to number that will remove offending players grab
PlayerTemp2 = T
T = DodgeBlockDisarmDialog.PlayerTemp
Checks = NumberArrayStorageForSpecialCards
End If
'Discard
Player1HandGroup(NumberArray(Checks)).QuantityInteger(T) -= 1
'Add Card to Discard Pile
DiscardGroup(NumberArray(Checks)).QuantityInteger(0) += 1
'Shuffle Deck from Discard Pile if Deck is out of cards
Call DiscardPile()
'Reset Number Generator, unless weapon isn't discard
Call RandomNumberGenerator()
If DeckGroup(Number).QuantityInteger(0) > 0 Then
DeckGroup(Number).QuantityInteger(0) -= 1
'Select the Player depending value of T
Player1HandGroup(Number).QuantityInteger(T) += 1
NumberArray(Checks) = Number
If Grab <> 3 Then
For FillCheckBoxes As Integer = 5 * T To (5 * T) + 4
CardCheckBoxArray(FillCheckBoxes Mod 5).Text = Player1HandGroup(NumberArray(FillCheckBoxes)).CardNameString
Next
End If
End If
'Remove Defending players block card
If Grab = 1 Then
Grab = 2
Call GrabFromDeckAndDiscard()
Exit Sub
'Remove defending players Grab card
ElseIf Grab = 2 Then
Grab = 3
Call GrabFromDeckAndDiscard()
Exit Sub
'Remove offenders Grab card
ElseIf Grab = 3 Then
Grab = 0
GrabInPlace = False
T = PlayerTemp2
Exit Sub
End If
Call SpecialCards()
End Sub