我正在尝试制作游戏,但我遇到了一个问题:我不知道如何为技能设置冷却时间。示例:“鲍勃对目标造成 25 点伤害并眩晕他们的攻击技能,直到使用新的友方技能。” 好的,现在轮到 Bab 了。巴布使用友方技能和结束回合。鲍勃会在每回合攻击25点伤害和眩晕,使得鲍勃的进攻技能被眩晕。
那么,我怎样才能让鲍勃的 25 伤害攻击有 1 回合的冷却时间呢?
有代码:
公开课形式1
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wparam As Integer, ByVal lParam As Integer) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
Dim n As New Random
If n.Next(100) <= 50 Then
KyuubiChakra.Visible = 0
KyuubiRasengan.Visible = 0
Else
DarkGenjutsu.Visible = 0
WaterControl.Visible = 0
End If
End Sub
Private Sub RESET_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RESET.Click
ProgressBar1.Value = 100
ProgressBar2.Value = 100
Label1.Text = ""
Label2.Text = ""
Label3.Text = ""
Label4.Text = ""
Label5.Text = ""
Label6.Text = ""
KyuubiChakra.Visible = 1
KyuubiRasengan.Visible = 1
DarkGenjutsu.Visible = 1
WaterControl.Visible = 1
Dim t As New Random
If t.Next(100) <= 50 Then
KyuubiChakra.Visible = 0
KyuubiRasengan.Visible = 0
Else
DarkGenjutsu.Visible = 0
WaterControl.Visible = 0
End If
End Sub
Private Sub NidaimeHokage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NidaimeHokage.Click
Label1.ForeColor = Color.Blue
Label1.Text = "Nidaime Hokage"
Label2.Text = "The second Hokage from Konoha."
Label3.Text = ""
End Sub
Private Sub KyuubiNaruto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KyuubiNaruto.Click
Label4.ForeColor = Color.Blue
Label4.Text = "Kyuubi Naruto"
Label5.Text = "Enraged Naruto."
Label6.Text = ""
End Sub
Private Sub DarkGenjutsu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DarkGenjutsu.Click
Label1.ForeColor = Color.Black
Label1.Text = "Dark Genjutsu"
Label2.Text = "Nidaime Hokage steals 35 health points from a target."
Label3.Text = "This skill can only be used when Nidaime has 35 or less health."
End Sub
Private Sub WaterControl_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WaterControl.Click
Label1.ForeColor = Color.Black
Label1.Text = "Water Control"
Label2.Text = "Nidaime Hokage deals 25 damage to a target and"
Label3.Text = "stun offensive skills until that target use a friendly skill."
End Sub
Private Sub KyuubiChakra_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KyuubiChakra.Click
Label4.ForeColor = Color.Black
Label4.Text = "Rage Chakra"
Label5.Text = "Kyuubi Naruto deals 10 damage to"
Label6.Text = "a target and heals 15 health points."
End Sub
Private Sub KyuubiRasengan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KyuubiRasengan.Click
Label4.ForeColor = Color.Black
Label4.Text = "Kyuubi Rasengan"
Label5.Text = "Kyuubi Naruto deals 55 damage to"
Label6.Text = "a target and loses 20 health points."
End Sub
Private Sub DarkGenjutsu_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles DarkGenjutsu.DoubleClick
If ProgressBar1.Value <= 35 Then
DarkGenjutsu.Visible = 0
WaterControl.Visible = 0
KyuubiChakra.Visible = 1
KyuubiRasengan.Visible = 1
End If
If ProgressBar2.Value - 35 < ProgressBar2.Minimum And ProgressBar1.Value <= 35 Then
ProgressBar2.Value = ProgressBar2.Minimum
ElseIf ProgressBar1.Value <= 35 Then
ProgressBar2.Value = ProgressBar2.Value - 35
End If
If ProgressBar1.Value <= 35 Then
ProgressBar1.Value = ProgressBar1.Value + 35
End If
If ProgressBar2.Value = ProgressBar2.Minimum Then
MessageBox.Show("Nidaime Wins!")
End If
End Sub
Private Sub WaterControl_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles WaterControl.DoubleClick
If ProgressBar2.Value - 25 < ProgressBar2.Minimum Then
ProgressBar2.Value = ProgressBar2.Minimum
Else
ProgressBar2.Value = ProgressBar2.Value - 25
DarkGenjutsu.Visible = 0
WaterControl.Visible = 0
KyuubiChakra.Visible = 1
KyuubiRasengan.Visible = 0
End If
If ProgressBar2.Value = 0 Then
MessageBox.Show("Nidaime Wins!")
End If
End Sub
Private Sub KyuubiChakra_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles KyuubiChakra.DoubleClick
If ProgressBar1.Value - 10 < ProgressBar1.Minimum Then
ProgressBar1.Value = ProgressBar1.Minimum
Else
ProgressBar1.Value = ProgressBar1.Value - 10
KyuubiChakra.Visible = 0
KyuubiRasengan.Visible = 0
DarkGenjutsu.Visible = 1
WaterControl.Visible = 1
End If
If ProgressBar1.Value = 0 Then
MessageBox.Show("Naruto Wins!")
End If
If ProgressBar2.Value + 15 > ProgressBar2.Maximum Then
ProgressBar2.Value = ProgressBar2.Maximum
Else
ProgressBar2.Value = ProgressBar2.Value + 15
End If
End Sub
Private Sub KyuubiRasengan_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles KyuubiRasengan.DoubleClick
If ProgressBar1.Value - 55 < ProgressBar1.Minimum Then
ProgressBar1.Value = ProgressBar1.Minimum
Else
ProgressBar1.Value = ProgressBar1.Value - 55
KyuubiChakra.Visible = 0
KyuubiRasengan.Visible = 0
DarkGenjutsu.Visible = 1
WaterControl.Visible = 1
End If
If ProgressBar2.Value - 20 < ProgressBar2.Minimum Then
ProgressBar2.Value = ProgressBar2.Minimum
Else
ProgressBar2.Value = ProgressBar2.Value - 20
End If
If ProgressBar1.Value = ProgressBar1.Minimum Then
MessageBox.Show("Naruto Wins!")
ElseIf ProgressBar2.Value <= ProgressBar2.Minimum Then
MessageBox.Show("Nidaime Wins!")
End If
End Sub
Private Sub DarkGenjutsuSTUN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DarkGenjutsuSTUN.Click
Label1.ForeColor = Color.Black
Label1.Text = "Dark Genjutsu"
Label2.Text = "Nidaime Hokage steals 35 health points from a target."
Label3.Text = "This skill only can be used when Nidaime has 35 or less health."
End Sub
Private Sub WaterControlSTUN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WaterControlSTUN.Click
Label1.ForeColor = Color.Black
Label1.Text = "Water Control"
Label2.Text = "Nidaime Hokage deals 25 damage to a target and"
Label3.Text = "stun offensive skills until that target use a friendly skill."
End Sub
Private Sub KyuubiChakraSTUN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KyuubiChakraSTUN.Click
Label4.ForeColor = Color.Black
Label4.Text = "Rage Chakra"
Label5.Text = "Kyuubi Naruto deals 10 damage to"
Label6.Text = "a target and heals 15 health points."
End Sub
Private Sub KyuubiRasenganSTUN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KyuubiRasenganSTUN.Click
Label4.ForeColor = Color.Black
Label4.Text = "Kyuubi Rasengan"
Label5.Text = "Kyuubi Naruto deals 55 damage to"
Label6.Text = "a target and loses 20 health points."
End Sub
Private Sub Timer1_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
ProgressBar1.Increment(0)
ProgressBar2.Increment(0)
Label7.Text = ProgressBar1.Value
Label8.Text = ProgressBar2.Value
If ProgressBar1.Value >= 65 Then
SendMessage(ProgressBar1.Handle, 1040, 1, 0)
Label7.ForeColor = Color.Green
End If
If ProgressBar1.Value < 65 And ProgressBar1.Value >= 35 Then
SendMessage(ProgressBar1.Handle, 1040, 3, 0)
Label7.ForeColor = Color.Yellow
End If
If ProgressBar1.Value < 35 Then
SendMessage(ProgressBar1.Handle, 1040, 2, 0)
Label7.ForeColor = Color.Red
End If
If ProgressBar2.Value >= 65 Then
SendMessage(ProgressBar2.Handle, 1040, 1, 0)
Label8.ForeColor = Color.Green
End If
If ProgressBar2.Value < 65 And ProgressBar1.Value >= 35 Then
SendMessage(ProgressBar2.Handle, 1040, 3, 0)
Label8.ForeColor = Color.Yellow
End If
If ProgressBar2.Value < 35 Then
SendMessage(ProgressBar2.Handle, 1040, 2, 0)
Label8.ForeColor = Color.Red
End If
End Sub
Private Sub Pass1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Pass1.Click
DarkGenjutsu.Visible = 0
WaterControl.Visible = 0
KyuubiRasengan.Visible = 1
KyuubiChakra.Visible = 1
End Sub
Private Sub Pass2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Pass2.Click
DarkGenjutsu.Visible = 1
WaterControl.Visible = 1
KyuubiRasengan.Visible = 0
KyuubiChakra.Visible = 0
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
ProgressBar1.Increment(0)
ProgressBar2.Increment(0)
Label7.Text = ProgressBar1.Value
Label8.Text = ProgressBar2.Value
If ProgressBar1.Value >= 65 Then
SendMessage(ProgressBar1.Handle, 1040, 1, 0)
Label7.ForeColor = Color.Green
End If
If ProgressBar1.Value < 65 And ProgressBar1.Value >= 35 Then
SendMessage(ProgressBar1.Handle, 1040, 3, 0)
Label7.ForeColor = Color.Yellow
End If
If ProgressBar1.Value < 35 Then
SendMessage(ProgressBar1.Handle, 1040, 2, 0)
Label7.ForeColor = Color.Red
End If
If ProgressBar2.Value >= 65 Then
SendMessage(ProgressBar2.Handle, 1040, 1, 0)
Label8.ForeColor = Color.Green
End If
If ProgressBar2.Value < 65 And ProgressBar1.Value >= 35 Then
SendMessage(ProgressBar2.Handle, 1040, 3, 0)
Label8.ForeColor = Color.Yellow
End If
If ProgressBar2.Value < 35 Then
SendMessage(ProgressBar2.Handle, 1040, 2, 0)
Label8.ForeColor = Color.Red
End If
End Sub
结束类