2016-09-07 18:50:38 +02:00
|
|
|
|
Namespace BattleSystem
|
|
|
|
|
|
|
|
|
|
''' <summary>
|
|
|
|
|
''' A class to execute GameMode attack functions.
|
|
|
|
|
''' </summary>
|
|
|
|
|
Public Class AttackSpecialFunctions
|
|
|
|
|
|
|
|
|
|
''' <summary>
|
|
|
|
|
''' Executes the attack function(s).
|
|
|
|
|
''' </summary>
|
|
|
|
|
''' <param name="Move">The move containing the attack function.</param>
|
|
|
|
|
''' <param name="own">Own toggle.</param>
|
|
|
|
|
''' <param name="BattleScreen">Reference to the BattleScreen.</param>
|
2022-02-27 15:28:45 +01:00
|
|
|
|
Public Shared Sub ExecuteMoveHitsFunction(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen)
|
2022-06-09 21:29:30 +02:00
|
|
|
|
Dim functions() As String = Move.GameModeFunction.Split("|")
|
2022-02-22 22:25:49 +01:00
|
|
|
|
For i = 0 To functions.Count - 1
|
|
|
|
|
Dim f As String = functions(i)
|
|
|
|
|
Dim fMain As String = f
|
|
|
|
|
Dim fSub As String = ""
|
|
|
|
|
If f.Contains(",") = True Then
|
|
|
|
|
fMain = f.GetSplit(0, ",")
|
2022-03-26 11:47:07 +01:00
|
|
|
|
fSub = f.GetSplit(1, ",")
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Select Case fMain.ToLower()
|
2022-03-26 11:47:07 +01:00
|
|
|
|
Case "cameraangle"
|
|
|
|
|
Dim Direction As Integer = CInt(fSub)
|
2022-06-09 21:29:30 +02:00
|
|
|
|
Select Case Direction
|
|
|
|
|
Case 0
|
|
|
|
|
BattleScreen.Battle.ChangeCameraAngle(0, own, BattleScreen)
|
|
|
|
|
Case 1
|
|
|
|
|
BattleScreen.Battle.ChangeCameraAngle(1, True, BattleScreen)
|
|
|
|
|
Case 2
|
|
|
|
|
BattleScreen.Battle.ChangeCameraAngle(2, True, BattleScreen)
|
|
|
|
|
End Select
|
|
|
|
|
Case "message", "text"
|
|
|
|
|
fSub = Localization.GetString(fSub, fSub)
|
2022-02-27 15:28:45 +01:00
|
|
|
|
BattleScreen.BattleQuery.Add(New TextQueryObject(fSub))
|
2022-06-09 21:29:30 +02:00
|
|
|
|
Case "raisestat", "increasestat"
|
|
|
|
|
Dim Stat As String = f.GetSplit(1, ",")
|
|
|
|
|
Dim Target As Boolean = own
|
|
|
|
|
Dim Message As String = ""
|
|
|
|
|
Dim RaiseAmount As Integer = 1
|
|
|
|
|
|
|
|
|
|
If f.Split(CChar(",")).Count > 2 Then
|
|
|
|
|
Target = CBool(f.GetSplit(2, ","))
|
|
|
|
|
If f.Split(CChar(",")).Count > 3 Then
|
|
|
|
|
Message = f.GetSplit(3, ",")
|
|
|
|
|
If f.Split(CChar(",")).Count > 4 Then
|
|
|
|
|
If CInt(f.GetSplit(4, ",")) > 0 Then
|
|
|
|
|
RaiseAmount = CInt(f.GetSplit(4, ","))
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End If
|
2022-06-10 10:13:23 +02:00
|
|
|
|
BattleScreen.Battle.RaiseStat(Target, own, BattleScreen, Stat, RaiseAmount, Message, "move:" & Move.Name, True)
|
2022-06-09 21:29:30 +02:00
|
|
|
|
Case "lowerstat", "decreasestat"
|
|
|
|
|
Dim Stat As String = f.GetSplit(1, ",")
|
|
|
|
|
Dim Message As String = ""
|
|
|
|
|
Dim Target As Boolean = own
|
|
|
|
|
Dim LowerAmount As Integer = 1
|
|
|
|
|
If f.Split(CChar(",")).Count > 2 Then
|
|
|
|
|
Target = CBool(f.GetSplit(2, ","))
|
|
|
|
|
If f.Split(CChar(",")).Count > 3 Then
|
|
|
|
|
Message = f.GetSplit(3, ",")
|
|
|
|
|
If f.Split(CChar(",")).Count > 4 Then
|
|
|
|
|
If CInt(f.GetSplit(4, ",")) > 0 Then
|
|
|
|
|
LowerAmount = CInt(f.GetSplit(4, ","))
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End If
|
2022-06-10 10:13:23 +02:00
|
|
|
|
BattleScreen.Battle.LowerStat(Target, own, BattleScreen, Stat, LowerAmount, Message, "move:" & Move.Name, True)
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Case "reducehp", "drainhp", "damage"
|
2022-06-09 21:29:30 +02:00
|
|
|
|
Dim Target As Boolean = CBool(f.GetSplit(1, ","))
|
|
|
|
|
Dim HPAmount As Integer = 0
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Dim Message As String = ""
|
2022-03-26 11:47:07 +01:00
|
|
|
|
|
2022-06-09 21:29:30 +02:00
|
|
|
|
If f.Split(CChar(",")).Count > 2 Then
|
|
|
|
|
HPAmount = CInt(f.GetSplit(2, ","))
|
|
|
|
|
If f.Split(CChar(",")).Count > 3 Then
|
|
|
|
|
Message = f.GetSplit(3, ",")
|
2022-02-22 22:25:49 +01:00
|
|
|
|
End If
|
|
|
|
|
End If
|
2022-06-09 21:29:30 +02:00
|
|
|
|
BattleScreen.Battle.ReduceHP(HPAmount, Target, own, BattleScreen, Message, Move.Name.ToLower)
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Case "gainhp", "increasehp", "heal"
|
2022-06-09 21:29:30 +02:00
|
|
|
|
Dim Target As Boolean = CBool(f.GetSplit(1, ","))
|
|
|
|
|
Dim HPAmount As Integer = 0
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Dim Message As String = ""
|
2022-03-26 11:47:07 +01:00
|
|
|
|
|
2022-06-09 21:29:30 +02:00
|
|
|
|
If f.Split(CChar(",")).Count > 2 Then
|
|
|
|
|
HPAmount = CInt(f.GetSplit(2, ","))
|
|
|
|
|
If f.Split(CChar(",")).Count > 3 Then
|
|
|
|
|
Message = f.GetSplit(3, ",")
|
2022-02-22 22:25:49 +01:00
|
|
|
|
End If
|
|
|
|
|
End If
|
2022-06-09 21:29:30 +02:00
|
|
|
|
BattleScreen.Battle.GainHP(HPAmount, Target, own, BattleScreen, Message, Move.Name.ToLower)
|
2022-02-27 15:28:45 +01:00
|
|
|
|
Case "endbattle"
|
|
|
|
|
Dim Blackout As Boolean = False
|
2022-03-26 11:47:07 +01:00
|
|
|
|
|
2022-06-09 21:29:30 +02:00
|
|
|
|
If f.Split(CChar(",")).Count > 2 Then
|
|
|
|
|
Blackout = CBool(fSub)
|
2022-02-27 15:28:45 +01:00
|
|
|
|
End If
|
2022-06-09 21:29:30 +02:00
|
|
|
|
BattleScreen.BattleQuery.Add(New EndBattleQueryObject(Blackout))
|
2022-03-26 11:47:07 +01:00
|
|
|
|
Case "faint"
|
2022-06-09 21:29:30 +02:00
|
|
|
|
Dim Target As Boolean = CBool(f.GetSplit(1, ","))
|
2022-03-26 11:47:07 +01:00
|
|
|
|
Dim Message As String = ""
|
|
|
|
|
|
2022-06-09 21:29:30 +02:00
|
|
|
|
If f.Split(CChar(",")).Count > 2 Then
|
|
|
|
|
Message = f.GetSplit(2, ",")
|
2022-03-26 11:47:07 +01:00
|
|
|
|
End If
|
2022-06-09 21:29:30 +02:00
|
|
|
|
BattleScreen.Battle.FaintPokemon(Not Target, BattleScreen, Message)
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Case Else
|
|
|
|
|
fSub = CInt(f.GetSplit(1, ",")).Clamp(0, 100).ToString
|
|
|
|
|
End Select
|
|
|
|
|
Else
|
|
|
|
|
Select Case f.ToLower()
|
|
|
|
|
Case "freeze"
|
|
|
|
|
fSub = "15"
|
|
|
|
|
Case "poison"
|
|
|
|
|
fSub = "40"
|
|
|
|
|
Case "toxic", "badpoison"
|
|
|
|
|
fSub = "25"
|
|
|
|
|
Case Else
|
|
|
|
|
fSub = "30"
|
|
|
|
|
End Select
|
|
|
|
|
End If
|
2016-09-07 18:50:38 +02:00
|
|
|
|
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Select Case fMain.ToLower()
|
2016-09-07 18:50:38 +02:00
|
|
|
|
Case "paralyze"
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Paralyze(Move, own, BattleScreen, CInt(fSub))
|
2016-09-07 18:50:38 +02:00
|
|
|
|
Case "poison"
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Poison(Move, own, BattleScreen, CInt(fSub))
|
2016-09-07 18:50:38 +02:00
|
|
|
|
Case "toxic", "badpoison"
|
2022-02-22 22:25:49 +01:00
|
|
|
|
BadPoison(Move, own, BattleScreen, CInt(fSub))
|
2016-09-07 18:50:38 +02:00
|
|
|
|
Case "burn"
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Burn(Move, own, BattleScreen, CInt(fSub))
|
2016-09-07 18:50:38 +02:00
|
|
|
|
Case "freeze"
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Freeze(Move, own, BattleScreen, CInt(fSub))
|
2016-09-07 18:50:38 +02:00
|
|
|
|
Case "sleep"
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Sleep(Move, own, BattleScreen, CInt(fSub))
|
2016-09-07 18:50:38 +02:00
|
|
|
|
End Select
|
|
|
|
|
Next
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Shared Function GetEffectChanceResult(ByVal move As Attack, ByVal chance As Integer) As Boolean
|
|
|
|
|
If move.Category = Attack.Categories.Special Then
|
|
|
|
|
Return True
|
|
|
|
|
Else
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Return Core.Random.Next(0, 100) <= chance
|
2016-09-07 18:50:38 +02:00
|
|
|
|
End If
|
|
|
|
|
End Function
|
|
|
|
|
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Private Shared Sub Paralyze(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen, Chance As Integer)
|
|
|
|
|
If GetEffectChanceResult(Move, Chance) = True Then
|
2016-09-07 18:50:38 +02:00
|
|
|
|
If BattleScreen.Battle.InflictParalysis(Not own, own, BattleScreen, "", "move:" & Move.Name.ToLower()) = False Then
|
|
|
|
|
If Move.Category = Attack.Categories.Status Then BattleScreen.BattleQuery.Add(New TextQueryObject(Move.Name & " failed!"))
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Private Shared Sub Burn(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen, Chance As Integer)
|
|
|
|
|
If GetEffectChanceResult(Move, Chance) = True Then
|
2016-09-07 18:50:38 +02:00
|
|
|
|
If BattleScreen.Battle.InflictBurn(Not own, own, BattleScreen, "", "move:" & Move.Name.ToLower()) = False Then
|
|
|
|
|
If Move.Category = Attack.Categories.Status Then BattleScreen.BattleQuery.Add(New TextQueryObject(Move.Name & " failed!"))
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Private Shared Sub Sleep(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen, Chance As Integer)
|
|
|
|
|
If GetEffectChanceResult(Move, Chance) = True Then
|
2016-09-07 18:50:38 +02:00
|
|
|
|
If BattleScreen.Battle.InflictSleep(Not own, own, BattleScreen, -1, "", "move:" & Move.Name.ToLower()) = False Then
|
|
|
|
|
If Move.Category = Attack.Categories.Status Then BattleScreen.BattleQuery.Add(New TextQueryObject(Move.Name & " failed!"))
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Private Shared Sub Freeze(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen, Chance As Integer)
|
|
|
|
|
If GetEffectChanceResult(Move, Chance) = True Then
|
2016-09-07 18:50:38 +02:00
|
|
|
|
If BattleScreen.Battle.InflictFreeze(Not own, own, BattleScreen, "", "move:" & Move.Name.ToLower()) = False Then
|
|
|
|
|
If Move.Category = Attack.Categories.Status Then BattleScreen.BattleQuery.Add(New TextQueryObject(Move.Name & " failed!"))
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Private Shared Sub Poison(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen, Chance As Integer)
|
|
|
|
|
If GetEffectChanceResult(Move, Chance) = True Then
|
2016-09-07 18:50:38 +02:00
|
|
|
|
If BattleScreen.Battle.InflictPoison(Not own, own, BattleScreen, False, "", "move:" & Move.Name.ToLower()) = False Then
|
|
|
|
|
If Move.Category = Attack.Categories.Status Then BattleScreen.BattleQuery.Add(New TextQueryObject(Move.Name & " failed!"))
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
|
2022-02-22 22:25:49 +01:00
|
|
|
|
Private Shared Sub BadPoison(ByVal Move As Attack, ByVal own As Boolean, ByVal BattleScreen As BattleScreen, Chance As Integer)
|
|
|
|
|
If GetEffectChanceResult(Move, Chance) = True Then
|
2016-09-07 18:50:38 +02:00
|
|
|
|
If BattleScreen.Battle.InflictPoison(Not own, own, BattleScreen, True, "", "move:" & Move.Name.ToLower()) = False Then
|
|
|
|
|
If Move.Category = Attack.Categories.Status Then BattleScreen.BattleQuery.Add(New TextQueryObject(Move.Name & " failed!"))
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
End Class
|
|
|
|
|
|
|
|
|
|
End Namespace
|