Battle Animation System Rework about halfway done

Updated to work with the new animation system:
- Catch animation
- Burn animation
- Attack: Tackle
This commit is contained in:
JappaWakka 2021-10-14 01:21:10 +02:00 committed by JappaWakkaP3D
parent b95d4d1c69
commit 7ff7f96a47
13 changed files with 448 additions and 364 deletions

View File

@ -1,4 +1,4 @@
Public Class BABillMove
Public Class BAEntityMove
Inherits BattleAnimation3D
@ -20,7 +20,7 @@
Linear
End Enum
Public Sub New(ByRef entity As Entity, ByVal Destination As Vector3, ByVal Speed As Single, ByVal SpinX As Boolean, ByVal SpinZ As Boolean, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal SpinXSpeed As Single = 0.1F, Optional ByVal SpinZSpeed As Single = 0.1F, Optional MovementCurve As Integer = 3)
Public Sub New(ByRef Entity As Entity, ByVal Destination As Vector3, ByVal Speed As Single, ByVal SpinX As Boolean, ByVal SpinZ As Boolean, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal SpinXSpeed As Single = 0.1F, Optional ByVal SpinZSpeed As Single = 0.1F, Optional MovementCurve As Integer = 3)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
Me.Destination = Destination
@ -33,7 +33,7 @@
Me.SpinSpeedZ = SpinZSpeed
Me.Visible = False
Me.TargetEntity = entity
Me.TargetEntity = Entity
Select Case MovementCurve
Case Curves.EaseIn

View File

@ -1,4 +1,4 @@
Public Class BABillOpacity
Public Class BAEntityOpacity
Inherits BattleAnimation3D

View File

@ -0,0 +1,131 @@
Public Class BAEntityRotate
Inherits BattleAnimation3D
Dim TargetEntity As Entity
Dim RotationSpeedVector As Vector3
Dim EndRotation As Vector3
Dim DoReturn As Boolean = False
Dim ReturnVector As Vector3
Dim hasReturned As Boolean = False
Dim DoRotation As Vector3 = New Vector3(1.0F)
Public Sub New(ByVal Entity As Entity, ByVal RotationSpeedVector As Vector3, ByVal EndRotation As Vector3, ByVal startDelay As Single, ByVal endDelay As Single)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
Me.RotationSpeedVector = RotationSpeedVector
Me.EndRotation = EndRotation
Me.ReturnVector = Me.Rotation
Me.TargetEntity = Entity
End Sub
Public Sub New(ByVal Entity As Entity, ByVal RotationSpeedVector As Vector3, ByVal EndRotation As Vector3, ByVal startDelay As Single, ByVal endDelay As Single, ByVal DoXRotation As Boolean, ByVal DoYRotation As Boolean, ByVal DoZRotation As Boolean)
Me.New(Entity, RotationSpeedVector, EndRotation, startDelay, endDelay)
If DoXRotation = False Then
DoRotation.X = 0.0F
End If
If DoYRotation = False Then
DoRotation.Y = 0.0F
End If
If DoZRotation = False Then
DoRotation.Z = 0.0F
End If
End Sub
Public Sub New(ByVal Entity As Entity, ByVal RotationSpeedVector As Vector3, ByVal EndRotation As Vector3, ByVal startDelay As Single, ByVal endDelay As Single, ByVal DoXRotation As Boolean, ByVal DoYRotation As Boolean, ByVal DoZRotation As Boolean, ByVal DoReturn As Boolean)
Me.New(Entity, RotationSpeedVector, EndRotation, startDelay, endDelay, DoXRotation, DoYRotation, DoZRotation)
Me.DoReturn = DoReturn
End Sub
Public Overrides Sub DoActionActive()
If VectorReached() = False Then
If DoRotation.X = 1.0F Then
If TargetEntity.Rotation.X > Me.EndRotation.X Then
TargetEntity.Rotation.X += Me.RotationSpeedVector.X
If TargetEntity.Rotation.X <= Me.EndRotation.X Then
TargetEntity.Rotation.X = Me.EndRotation.X
End If
ElseIf TargetEntity.Rotation.X < Me.EndRotation.X Then
TargetEntity.Rotation.X += Me.RotationSpeedVector.X
If TargetEntity.Rotation.X >= Me.EndRotation.X Then
TargetEntity.Rotation.X = Me.EndRotation.X
End If
End If
End If
If DoRotation.Y = 1.0F Then
If TargetEntity.Rotation.Y > Me.EndRotation.Y Then
TargetEntity.Rotation.Y += Me.RotationSpeedVector.Y
If TargetEntity.Rotation.Y <= Me.EndRotation.Y Then
TargetEntity.Rotation.Y = Me.EndRotation.Y
End If
ElseIf TargetEntity.Rotation.Y < Me.EndRotation.Y Then
TargetEntity.Rotation.Y += Me.RotationSpeedVector.Y
If TargetEntity.Rotation.Y >= Me.EndRotation.Y Then
TargetEntity.Rotation.Y = Me.EndRotation.Y
End If
End If
End If
If DoRotation.Z = 1.0F Then
If TargetEntity.Rotation.Z > Me.EndRotation.Z Then
TargetEntity.Rotation.Z += Me.RotationSpeedVector.Z
If TargetEntity.Rotation.Z <= Me.EndRotation.Z Then
TargetEntity.Rotation.Z = Me.EndRotation.Z
End If
ElseIf TargetEntity.Rotation.Z < Me.EndRotation.Z Then
TargetEntity.Rotation.Z += Me.RotationSpeedVector.Z
If TargetEntity.Rotation.Z >= Me.EndRotation.Z Then
TargetEntity.Rotation.Z = Me.EndRotation.Z
End If
End If
End If
If VectorReached() = True Then
RotationReady()
End If
Else
RotationReady()
End If
End Sub
Private Sub RotationReady()
If Me.DoReturn = True And Me.hasReturned = False Then
Me.hasReturned = True
Me.EndRotation = Me.ReturnVector
Me.RotationSpeedVector = New Vector3(Me.RotationSpeedVector.X * -1, Me.RotationSpeedVector.Y * -1, Me.RotationSpeedVector.Z * -1)
Else
Me.Ready = True
End If
End Sub
Private Function VectorReached() As Boolean
If DoRotation.X = 1.0F Then
If EndRotation.X <> TargetEntity.Rotation.X Then
Return False
End If
End If
If DoRotation.Y = 1.0F Then
If EndRotation.Y <> TargetEntity.Rotation.Y Then
Return False
End If
End If
If DoRotation.Z = 1.0F Then
If EndRotation.Z <> TargetEntity.Rotation.Z Then
Return False
End If
End If
Return True
End Function
End Class

View File

@ -1,4 +1,4 @@
Public Class BABillSize
Public Class BAEntityScale
Inherits BattleAnimation3D

View File

@ -0,0 +1,21 @@
Public Class BAEntityTextureChange
Inherits BattleAnimation3D
Public Texture As Texture2D
Public TargetEntity As Entity
Public Sub New(ByVal Entity As Entity, Texture As Texture2D, ByVal startDelay As Single, ByVal endDelay As Single)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
Me.TargetEntity = Entity
Me.Texture = Texture
Me.AnimationType = AnimationTypes.Texture
End Sub
Public Overrides Sub DoActionActive()
TargetEntity.Textures = {Me.Texture}
Me.Ready = True
End Sub
End Class

View File

@ -10,7 +10,7 @@
Public InterpolationSpeed As Single
Public SpinSpeedX As Single = 0.1F
Public SpinSpeedZ As Single = 0.1F
Public MovementCurve As Integer = 2
Public MovementCurve As Integer = 3
Private EasedIn As Boolean = False
Private EasedOut As Boolean = False

View File

@ -1,106 +0,0 @@
Public Class BASize
Inherits BattleAnimation3D
Public Grow As Boolean = False
Public EndSize As Vector3
Public SizeSpeed As Single = 0.01F
Public Anchors As String
Public Change As New Vector3(1)
Public Sub New(ByVal Position As Vector3, ByVal Texture As Texture2D, ByVal Scale As Vector3, ByVal Grow As Boolean, ByVal EndSize As Vector3, ByVal SizeSpeed As Single, ByVal startDelay As Single, ByVal endDelay As Single, ByVal Anchors As String)
MyBase.New(Position, Texture, Scale, startDelay, endDelay)
Me.Anchors = Anchors
Me.Grow = Grow
Me.EndSize = EndSize
Me.SizeSpeed = SizeSpeed
Me.AnimationType = AnimationTypes.Size
End Sub
Public Overrides Sub DoActionActive()
Dim saveScale As Vector3 = Me.Scale
Dim changeX As Single = SizeSpeed * Change.X
Dim changeY As Single = SizeSpeed * Change.Y
Dim changeZ As Single = SizeSpeed * Change.Z
If Grow = True Then
If Me.Scale.X < Me.EndSize.X Then
Me.Scale.X += changeX
If Me.Scale.X >= Me.EndSize.X Then
Me.Scale.X = Me.EndSize.X
End If
End If
If Me.Scale.Y < Me.EndSize.Y Then
Me.Scale.Y += changeY
If Me.Scale.Y >= Me.EndSize.Y Then
Me.Scale.Y = Me.EndSize.Y
End If
End If
If Me.Scale.Z < Me.EndSize.Z Then
Me.Scale.Z += changeZ
If Me.Scale.Z >= Me.EndSize.Z Then
Me.Scale.Z = Me.EndSize.Z
End If
End If
Else
If Me.Scale.X > Me.EndSize.X Then
Me.Scale.X -= changeX
If Me.Scale.X <= Me.EndSize.X Then
Me.Scale.X = Me.EndSize.X
End If
End If
If Me.Scale.Y > Me.EndSize.Y Then
Me.Scale.Y -= changeY
If Me.Scale.Y <= Me.EndSize.Y Then
Me.Scale.Y = Me.EndSize.Y
End If
End If
If Me.Scale.Z > Me.EndSize.Z Then
Me.Scale.Z -= changeZ
If Me.Scale.Z <= Me.EndSize.Z Then
Me.Scale.Z = Me.EndSize.Z
End If
End If
End If
'Bottom
If Anchors.Contains("1") = True Then
Dim diffY As Single = saveScale.Y - Me.Scale.Y
Me.Position.Y -= diffY / 2
End If
'Top
If Anchors.Contains("2") = True Then
Dim diffY As Single = saveScale.Y - Me.Scale.Y
Me.Position.Y += diffY / 2
End If
'Left
If Anchors.Contains("3") = True Then
Dim diffX As Single = saveScale.X - Me.Scale.X
Me.Position.X -= diffX / 2
End If
'Right
If Anchors.Contains("4") = True Then
Dim diffX As Single = saveScale.X - Me.Scale.X
Me.Position.X += diffX / 2
End If
If Me.EndSize = Me.Scale Then
Me.Ready = True
End If
End Sub
Public Sub SetChange(ByVal changeX As Single, ByVal changeY As Single, ByVal changeZ As Single)
Me.Change = New Vector3(changeX, changeY, changeZ)
End Sub
End Class

View File

@ -2705,14 +2705,20 @@
p.Status = Pokemon.StatusProblems.Burn
ChangeCameraAngle(1, own, BattleScreen)
'Burn animation
Dim BurnAnimation As AnimationQueryObject = New AnimationQueryObject(CType(pNPC, NPC), own)
Dim BurnAnimation As AnimationQueryObject = New AnimationQueryObject(pNPC, own)
BurnAnimation.AnimationPlaySound("Battle\Effects\Burned", 0, 0)
BurnAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Fire\Ember,0,0,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 1, 1)
BurnAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Fire\Ember,0,32,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 2, 1)
BurnAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Fire\Ember,0,64,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 3, 1)
BurnAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Fire\Ember,0,96,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 4, 1)
BurnAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Fire\Ember,0,128,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 5, 1)
Dim FlameEntity As Entity = BurnAnimation.SpawnEntity(New Vector3(CSng(pNPC.Position.X - 0.25), CSng(pNPC.Position.Y - 0.25), CSng(pNPC.Position.Z - 0.25)), TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 0, 32, 32)), New Vector3(0.5, 0.5, 0.5), 1.0F)
BurnAnimation.AnimationChangeTexture(FlameEntity, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 32, 32, 32)), 2, 1)
BurnAnimation.AnimationChangeTexture(FlameEntity, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 64, 32, 32)), 3, 1)
BurnAnimation.AnimationChangeTexture(FlameEntity, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 96, 32, 32)), 4, 1)
BurnAnimation.AnimationChangeTexture(FlameEntity, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 128, 32, 32)), 5, 1)
BurnAnimation.AnimationFadeEntity(FlameEntity, 1, False, 0.0F, 6, 1, 1)
BattleScreen.BattleQuery.Add(BurnAnimation)
If FlameEntity.Opacity = 0.0F Then
BurnAnimation.RemoveEntity(FlameEntity)
End If
Select Case message
Case "" 'Print default message only
BattleScreen.BattleQuery.Add(New TextQueryObject(p.GetDisplayName() & " got burned!"))
@ -2723,30 +2729,30 @@
BattleScreen.BattleQuery.Add(New TextQueryObject(p.GetDisplayName() & " got burned!"))
End Select
If p.Ability.Name.ToLower() = "synchronize" AndAlso from <> own Then
Me.InflictBurn(Not own, Not own, BattleScreen, "Synchronize passed over the burn.", "synchronize")
End If
Me.InflictBurn(Not own, Not own, BattleScreen, "Synchronize passed over the burn.", "synchronize")
End If
If Not p.Item Is Nothing Then
If p.Item.Name.ToLower() = "rawst" AndAlso BattleScreen.FieldEffects.CanUseItem(own) = True AndAlso BattleScreen.FieldEffects.CanUseOwnItem(own, BattleScreen) = True Then
If RemoveHeldItem(own, own, BattleScreen, "", "berry:rawst") = True Then
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject("Use_Item", False))
CureStatusProblem(own, own, BattleScreen, "The Rawst Berry cured the burn of " & p.GetDisplayName() & "!", "berry:rawst")
If Not p.Item Is Nothing Then
If p.Item.Name.ToLower() = "rawst" AndAlso BattleScreen.FieldEffects.CanUseItem(own) = True AndAlso BattleScreen.FieldEffects.CanUseOwnItem(own, BattleScreen) = True Then
If RemoveHeldItem(own, own, BattleScreen, "", "berry:rawst") = True Then
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject("Use_Item", False))
CureStatusProblem(own, own, BattleScreen, "The Rawst Berry cured the burn of " & p.GetDisplayName() & "!", "berry:rawst")
End If
End If
End If
End If
If Not p.Item Is Nothing Then
If p.Item.Name.ToLower() = "lum" AndAlso BattleScreen.FieldEffects.CanUseItem(own) = True AndAlso BattleScreen.FieldEffects.CanUseOwnItem(own, BattleScreen) = True Then
If RemoveHeldItem(own, own, BattleScreen, "", "berry:lum") = True Then
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject("Use_Item", False))
CureStatusProblem(own, own, BattleScreen, "The Lum Berry cured the burn of " & p.GetDisplayName() & "!", "berry:lum")
If Not p.Item Is Nothing Then
If p.Item.Name.ToLower() = "lum" AndAlso BattleScreen.FieldEffects.CanUseItem(own) = True AndAlso BattleScreen.FieldEffects.CanUseOwnItem(own, BattleScreen) = True Then
If RemoveHeldItem(own, own, BattleScreen, "", "berry:lum") = True Then
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject("Use_Item", False))
CureStatusProblem(own, own, BattleScreen, "The Lum Berry cured the burn of " & p.GetDisplayName() & "!", "berry:lum")
End If
End If
End If
End If
Return True
Return True
End If
End If
End If
End If
End If
End If
@ -3411,7 +3417,7 @@
End If
'***STAT INCREASE ANIMATION***
Dim MoveAnimation As AnimationQueryObject = New AnimationQueryObject(pNPC, Not own)
Dim StatAnimation As AnimationQueryObject = New AnimationQueryObject(pNPC, Not own)
Dim maxAmount As Integer = 20 * val
Dim currentAmount As Integer = 0
While currentAmount <= maxAmount
@ -3427,11 +3433,11 @@
Destination.X = xPos
Destination.Z = zPos
Dim startDelay As Double = 5.0 * Random.NextDouble()
MoveAnimation.AnimationSpawnMovingEntity(Position.X, Position.Y, Position.Z, Texture, Scale.X, Scale.Y, Scale.Z, Destination.X, Destination.Y, Destination.Z, 0.05F, False, True, CSng(startDelay), 0.0F)
StatAnimation.AnimationSpawnMovingEntity(Position.X, Position.Y, Position.Z, Texture, Scale.X, Scale.Y, Scale.Z, Destination.X, Destination.Y, Destination.Z, 0.05F, False, True, CSng(startDelay), 0.0F)
Threading.Interlocked.Increment(currentAmount)
End While
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject("Battle\Effects\Stat_Raise", False))
BattleScreen.BattleQuery.Add(MoveAnimation)
BattleScreen.BattleQuery.Add(StatAnimation)
Dim printMessage As String = p.GetDisplayName() & "'s " & statString
Select Case val
@ -3998,11 +4004,11 @@
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject(sound, False, 0.0F))
End If
Dim HitAnimation As AnimationQueryObject = New AnimationQueryObject(CType(pNPC, NPC), own)
HitAnimation.AnimationFadePokemonEntity(1, False, 0, 0, 0)
HitAnimation.AnimationFadePokemonEntity(1, True, 1, 1, 0)
HitAnimation.AnimationFadePokemonEntity(1, False, 0, 2, 0)
HitAnimation.AnimationFadePokemonEntity(1, True, 1, 3, 0)
Dim HitAnimation As AnimationQueryObject = New AnimationQueryObject(pNPC, own)
HitAnimation.AnimationFadeEntity(Nothing, 1, False, 0, 0, 0)
HitAnimation.AnimationFadeEntity(Nothing, 1, True, 1, 1, 0)
HitAnimation.AnimationFadeEntity(Nothing, 1, False, 0, 2, 0)
HitAnimation.AnimationFadeEntity(Nothing, 1, True, 1, 3, 0)
BattleScreen.BattleQuery.Add(HitAnimation)
If own = True Then
@ -5415,12 +5421,19 @@
'Burn animation
Dim BurnAnimation As AnimationQueryObject = New AnimationQueryObject(BattleScreen.OwnPokemonNPC, False)
BurnAnimation.AnimationPlaySound("Battle\Effects\Burned", 0, 0)
BurnAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Fire\Ember,0,0,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 1, 1)
BurnAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Fire\Ember,0,32,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 2, 1)
BurnAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Fire\Ember,0,64,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 3, 1)
BurnAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Fire\Ember,0,96,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 4, 1)
BurnAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Fire\Ember,0,128,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 5, 1)
Dim FlameEntity As Entity = BurnAnimation.SpawnEntity(New Vector3(CSng(BattleScreen.OwnPokemonNPC.Position.X + 0.25), CSng(BattleScreen.OwnPokemonNPC.Position.Y - 0.25), CSng(BattleScreen.OwnPokemonNPC.Position.Z + 0.25)), TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 0, 32, 32)), New Vector3(0.5, 0.5, 0.5), 1.0F)
BurnAnimation.AnimationChangeTexture(FlameEntity, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 32, 32, 32)), 2, 1)
BurnAnimation.AnimationChangeTexture(FlameEntity, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 64, 32, 32)), 3, 1)
BurnAnimation.AnimationChangeTexture(FlameEntity, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 96, 32, 32)), 4, 1)
BurnAnimation.AnimationChangeTexture(FlameEntity, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 128, 32, 32)), 5, 1)
BurnAnimation.AnimationFadeEntity(FlameEntity, 1, False, 0.0F, 6, 1, 1)
BattleScreen.BattleQuery.Add(BurnAnimation)
If FlameEntity.Opacity = 0.0F Then
BurnAnimation.RemoveEntity(FlameEntity)
End If
'Actual damage
ReduceHP(reduceAmount, True, True, BattleScreen, .OwnPokemon.GetDisplayName() & " is hurt by the burn.", "burn")
End If
@ -6206,12 +6219,19 @@
'Burn animation
Dim BurnAnimation As AnimationQueryObject = New AnimationQueryObject(BattleScreen.OppPokemonNPC, False)
BurnAnimation.AnimationPlaySound("Battle\Effects\Burned", 0, 0)
BurnAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Fire\Ember,0,0,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 1, 1)
BurnAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Fire\Ember,0,32,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 2, 1)
BurnAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Fire\Ember,0,64,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 3, 1)
BurnAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Fire\Ember,0,96,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 4, 1)
BurnAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Fire\Ember,0,128,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 5, 1)
Dim FlameEntity As Entity = BurnAnimation.SpawnEntity(New Vector3(CSng(BattleScreen.OppPokemonNPC.Position.X - 0.25), CSng(BattleScreen.OwnPokemonNPC.Position.Y - 0.25), CSng(BattleScreen.OwnPokemonNPC.Position.Z - 0.25)), TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 0, 32, 32)), New Vector3(0.5, 0.5, 0.5), 1.0F)
BurnAnimation.AnimationChangeTexture(FlameEntity, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 32, 32, 32)), 2, 1)
BurnAnimation.AnimationChangeTexture(FlameEntity, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 64, 32, 32)), 3, 1)
BurnAnimation.AnimationChangeTexture(FlameEntity, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 96, 32, 32)), 4, 1)
BurnAnimation.AnimationChangeTexture(FlameEntity, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 128, 32, 32)), 5, 1)
BurnAnimation.AnimationFadeEntity(FlameEntity, 1, False, 0.0F, 6, 1, 1)
BattleScreen.BattleQuery.Add(BurnAnimation)
If FlameEntity.Opacity = 0.0F Then
BurnAnimation.RemoveEntity(FlameEntity)
End If
'Actual damage
ReduceHP(reduceAmount, False, False, BattleScreen, .OppPokemon.GetDisplayName() & " is hurt by the burn.", "burn")
End If
@ -6796,8 +6816,8 @@
Loop While SmokeReturned <= 38
' Pokemon disappears
BallReturn.AnimationFadePokemonEntity(1, False, 0, 1, 0)
BallReturn.AnimationMovePokemonEntity(0, 0.5, 0, 0.5, False, False, 2, 0,,, 4)
BallReturn.AnimationFadeEntity(Nothing, 1, False, 0, 1, 0)
BallReturn.AnimationMoveEntity(Nothing, 0, 0.5, 0, 0.5, False, False, 2, 0,,, 3)
' Ball returns
BallReturn.AnimationPlaySound("Battle\Pokeball\Throw", 1, 0)
@ -6859,11 +6879,11 @@
Loop While SmokeSpawned <= 38
' Pokemon appears
BallThrow.AnimationFadePokemonEntity(1, True, 1, 4, 0)
BallThrow.AnimationFadeEntity(Nothing, 1, True, 1, 4, 0)
BallThrow.AnimationPlaySound(CStr(BattleScreen.OwnPokemon.Number), 4, 0,, True)
' Pokémon falls down
BallThrow.AnimationMovePokemonEntity(0, 0, 0, 0.05F, False, False, 4, 0,,, 4)
BallThrow.AnimationMoveEntity(Nothing, 0, 0, 0, 0.05F, False, False, 4, 0,,, 3)
BattleScreen.AddToQuery(InsertIndex, BallThrow)
End If
@ -7112,7 +7132,7 @@
ChangeCameraAngle(1, False, BattleScreen)
Dim Faint As AnimationQueryObject = New AnimationQueryObject(BattleScreen.OppPokemonNPC, True, BattleScreen.OppPokemonModel)
Faint.AnimationPlaySound(CStr(BattleScreen.OppPokemon.Number), 0, 2, False, True)
Faint.AnimationMovePokemonEntity(0, -1, 0, 0.1, False, False, 2, 0,,, 4)
Faint.AnimationMoveEntity(Nothing, 0, -1, 0, 0.1, False, False, 2, 0,,, 3)
BattleScreen.BattleQuery.Add(Faint)
BattleScreen.BattleQuery.Add(New ToggleEntityQueryObject(True, ToggleEntityQueryObject.BattleEntities.OppPokemon, 2, -1, -1, -1, -1))
@ -7157,8 +7177,8 @@
Loop While SmokeReturned <= 38
' Pokemon disappears
BallReturn.AnimationFadePokemonEntity(1, False, 0, 1, 0)
BallReturn.AnimationMovePokemonEntity(0, 0.5, 0, 0.5, False, False, 2, 0,,, 4)
BallReturn.AnimationFadeEntity(Nothing, 1, False, 0, 1, 0)
BallReturn.AnimationMoveEntity(Nothing, 0, 0.5, 0, 0.5, False, False, 2, 0,,, 4)
' Ball returns
BallReturn.AnimationPlaySound("Battle\Pokeball\Throw", 1, 0)
@ -7218,8 +7238,8 @@
Loop While SmokeReturned <= 38
' Pokemon disappears
BallReturn.AnimationFadePokemonEntity(1, False, 0, 1, 0)
BallReturn.AnimationMovePokemonEntity(0, 0.5, 0, 0.5, False, False, 2, 0,,, 4)
BallReturn.AnimationFadeEntity(Nothing, 1, False, 0, 1, 0)
BallReturn.AnimationMoveEntity(Nothing, 0, 0.5, 0, 0.5, False, False, 2, 0,,, 4)
' Ball returns
BallReturn.AnimationPlaySound("Battle\Pokeball\Throw", 1, 0)
@ -7273,11 +7293,11 @@
Loop While SmokeSpawned <= 38
' Pokemon appears
BallThrow.AnimationFadePokemonEntity(1, True, 1, 4, 0)
BallThrow.AnimationFadeEntity(Nothing, 1, True, 1, 4, 0)
BallThrow.AnimationPlaySound(CStr(BattleScreen.OppPokemon.Number), 4, 0,, True)
' Pokémon falls down
BallThrow.AnimationMovePokemonEntity(0, 0, 0, 0.05F, False, False, 4, 0,,, 4)
BallThrow.AnimationMoveEntity(Nothing, 0, 0, 0, 0.05F, False, False, 4, 0,,, 4)
BattleScreen.BattleQuery.Add(BallThrow)
End If

View File

@ -7,6 +7,7 @@
Public AnimationEnded As Boolean = False
Public BAFlipped As Boolean
Public AnimationSequence As List(Of BattleAnimation3D)
Public SpawnedEntities As List(Of Entity)
Public CurrentEntity As Entity
Public CurrentModel As ModelEntity
@ -16,7 +17,7 @@
End Get
End Property
Public Sub New(ByVal entity As NPC, ByVal BAFlipped As Boolean, Optional ByVal model As ModelEntity = Nothing)
Public Sub New(ByVal entity As Entity, ByVal BAFlipped As Boolean, Optional ByVal model As ModelEntity = Nothing)
MyBase.New(QueryTypes.MoveAnimation)
Me.AnimationSequence = New List(Of BattleAnimation3D)
Me.BAFlipped = BAFlipped
@ -54,20 +55,18 @@
If AnimationSequence.Count <= 0 Then
AnimationSequenceEnd()
End If
For Each Animation As BattleAnimation3D In AnimationSequence
Animation.UpdateEntity()
Next
For Each Entity As Entity In SpawnedEntities
Entity.UpdateEntity()
Next
End If
End Sub
Public Sub AnimationSequenceBegin()
If CurrentEntity Is Nothing Then
Logger.Log(Logger.LogTypes.Warning, "ATTEMPT TO USE AnimationSequenceBegin OUTSIDE OF ATTACK ANIMATION DELEGATE")
ElseIf AnimationStarted Then
Logger.Log(Logger.LogTypes.Warning, "ATTEMPT TO USE AnimationSequenceBegin INSIDE ANIMATION SEQUENCE, DID YOU MEAN AnimationSequenceEnd?")
Else
AnimationStarted = True
End If
AnimationStarted = True
End Sub
Public Sub AnimationSequenceEnd()
@ -80,6 +79,104 @@
End If
End Sub
Public Function SpawnEntity(ByVal Position As Vector3, ByVal Texture As Texture2D, ByVal Scale As Vector3, ByVal Opacity As Single) As Entity
Dim SpawnedEntity As Entity = New Entity(Position.X, Position.Y, Position.Z, "BattleAnimation", {Texture}, {0, 0}, False, 0, Scale, BaseModel.BillModel, 0, "", New Vector3(1.0F))
SpawnedEntity.Opacity = Opacity
If SpawnedEntity.Opacity > 0 Then
SpawnedEntity.Visible = True
Else
SpawnedEntity.Visible = False
End If
SpawnedEntities.Add(SpawnedEntity)
Return SpawnedEntity
End Function
Public Sub RemoveEntity(Entity As Entity)
SpawnedEntities.Remove(Entity)
End Sub
Public Sub AnimationChangeTexture(ByVal Entity As Entity, ByVal Texture As Texture2D, ByVal startDelay As Single, ByVal endDelay As Single)
Dim TextureChangeEntity As Entity
If Entity Is Nothing Then
TextureChangeEntity = CurrentEntity
Else
TextureChangeEntity = Entity
End If
Dim baEntityTextureChange As BAEntityTextureChange = New BAEntityTextureChange(TextureChangeEntity, Texture, startDelay, endDelay)
AnimationSequence.Add(baEntityTextureChange)
End Sub
Public Sub AnimationMoveEntity(ByVal Entity As Entity, ByVal DestinationX As Single, ByVal DestinationY As Single, ByVal DestinationZ As Single, ByVal Speed As Single, ByVal SpinX As Boolean, ByVal SpinZ As Boolean, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal SpinXSpeed As Single = 0.1F, Optional ByVal SpinZSpeed As Single = 0.1F, Optional MovementCurve As Integer = 3)
Dim MoveEntity As Entity
Dim Destination As Vector3
If Entity Is Nothing Then
MoveEntity = CurrentEntity
If BAFlipped Then
DestinationX -= DestinationX * 2.0F
DestinationZ -= DestinationZ * 2.0F
Destination = New Vector3(CurrentEntity.Position.X + DestinationX, CurrentEntity.Position.Y + DestinationY, CurrentEntity.Position.Z + DestinationZ)
End If
Else
MoveEntity = Entity
Destination = New Vector3(DestinationX, DestinationY, DestinationZ)
End If
Dim baEntityMove As BAEntityMove = New BAEntityMove(MoveEntity, Destination, Speed, SpinX, SpinZ, startDelay, endDelay, SpinXSpeed, SpinZSpeed, MovementCurve)
AnimationSequence.Add(baEntityMove)
If Me.CurrentModel IsNot Nothing Then
Dim baModelMove As BAEntityMove = New BAEntityMove(CType(CurrentModel, Entity), Destination, Speed, SpinX, SpinZ, startDelay, endDelay, SpinXSpeed, SpinZSpeed, MovementCurve)
AnimationSequence.Add(baModelMove)
End If
End Sub
Public Sub AnimationFadeEntity(ByVal Entity As Entity, ByVal TransitionSpeed As Single, ByVal FadeIn As Boolean, ByVal EndState As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal startState As Single = -1.0F)
Dim FadeEntity As Entity
If Entity Is Nothing Then
FadeEntity = CurrentEntity
Else
FadeEntity = Entity
End If
If startState = -1.0F Then startState = FadeEntity.Opacity
Dim baEntityOpacity As BAEntityOpacity = New BAEntityOpacity(FadeEntity, TransitionSpeed, FadeIn, EndState, startDelay, endDelay, startState)
AnimationSequence.Add(baEntityOpacity)
If Me.CurrentModel IsNot Nothing Then
Dim baModelOpacity As BAEntityOpacity = New BAEntityOpacity(CType(CurrentModel, Entity), TransitionSpeed, FadeIn, EndState, startDelay, endDelay, startState)
AnimationSequence.Add(baModelOpacity)
End If
End Sub
Public Sub AnimationRotateEntity(Entity As Entity, ByVal RotationSpeedX As Single, ByVal RotationSpeedY As Single, ByVal RotationSpeedZ As Single, ByVal EndRotationX As Single, ByVal EndRotationY As Single, ByVal EndRotationZ As Single, ByVal startDelay As Single, ByVal endDelay As Single, ByVal DoXRotation As Boolean, ByVal DoYRotation As Boolean, ByVal DoZRotation As Boolean, ByVal DoReturn As Boolean)
Dim RotateEntity As Entity
If Entity Is Nothing Then
RotateEntity = CurrentEntity
Else
RotateEntity = Entity
End If
Dim RotationSpeedVector As Vector3 = New Vector3(RotationSpeedX, RotationSpeedY, RotationSpeedZ)
Dim EndRotation As Vector3 = New Vector3(EndRotationX, EndRotationY, EndRotationZ)
Dim baEntityRotate As BAEntityRotate = New BAEntityRotate(RotateEntity, RotationSpeedVector, EndRotation, startDelay, endDelay, DoXRotation, DoYRotation, DoZRotation, DoReturn)
AnimationSequence.Add(baEntityRotate)
End Sub
Public Sub AnimationScaleEntity(ByVal Entity As Entity, ByVal Grow As Boolean, ByVal EndSizeX As Single, ByVal EndSizeY As Single, ByVal EndSizeZ As Single, ByVal SizeSpeed As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal Anchors As String = "1")
Dim ScaleEntity As Entity
If Entity Is Nothing Then
ScaleEntity = CurrentEntity
Else
ScaleEntity = Entity
End If
Dim Position As Vector3 = ScaleEntity.Position
Dim Scale As Vector3 = ScaleEntity.Scale
Dim EndSize As Vector3 = New Vector3(EndSizeX, EndSizeY, EndSizeZ)
Dim baBillSize As BAEntityScale = New BAEntityScale(ScaleEntity, Scale, Grow, EndSize, SizeSpeed, startDelay, endDelay, Anchors)
AnimationSequence.Add(baBillSize)
End Sub
Public Sub AnimationSpawnFadingEntity(ByVal PositionX As Single, ByVal PositionY As Single, ByVal PositionZ As Single, ByVal Texture As String, ByVal ScaleX As Single, ByVal ScaleY As Single, ByVal ScaleZ As Single, ByVal TransitionSpeed As Single, ByVal FadeIn As Boolean, ByVal EndState As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal startState As Single = 1.0F)
If CurrentEntity Is Nothing Then
Logger.Log(Logger.LogTypes.Warning, "ATTEMPT TO USE AttackSpawnMovingAnimation OUTSIDE OF ATTACK ANIMATION DELEGATE")
@ -142,44 +239,6 @@
AnimationSequence.Add(baMove)
End If
End Sub
Public Sub AnimationMovePokemonEntity(ByVal DestinationX As Single, ByVal DestinationY As Single, ByVal DestinationZ As Single, ByVal Speed As Single, ByVal SpinX As Boolean, ByVal SpinZ As Boolean, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal SpinXSpeed As Single = 0.1F, Optional ByVal SpinZSpeed As Single = 0.1F, Optional MovementCurve As Integer = 3)
If CurrentEntity Is Nothing Then
Logger.Log(Logger.LogTypes.Warning, "ATTEMPT TO USE AttackSpawnMovingAnimation OUTSIDE OF ATTACK ANIMATION DELEGATE")
ElseIf Not AnimationStarted Then
Logger.Log(Logger.LogTypes.Warning, "ATTEMPT TO USE AttackSpawnMovingAnimation BEFORE CALLING AnimationSequenceBegin")
Else
If BAFlipped Then
DestinationX -= DestinationX * 2.0F
DestinationZ -= DestinationZ * 2.0F
End If
Dim Destination As Vector3 = New Vector3(CurrentEntity.Position.X + DestinationX, CurrentEntity.Position.Y + DestinationY, CurrentEntity.Position.Z + DestinationZ)
Dim baBillMove As BABillMove = New BABillMove(CurrentEntity, Destination, Speed, SpinX, SpinZ, startDelay, endDelay, SpinXSpeed, SpinZSpeed, MovementCurve)
AnimationSequence.Add(baBillMove)
If Me.CurrentModel IsNot Nothing Then
Dim baModelMove As BABillMove = New BABillMove(CType(CurrentModel, Entity), Destination, Speed, SpinX, SpinZ, startDelay, endDelay, SpinXSpeed, SpinZSpeed, MovementCurve)
AnimationSequence.Add(baModelMove)
End If
End If
End Sub
Public Sub AnimationFadePokemonEntity(ByVal TransitionSpeed As Single, ByVal FadeIn As Boolean, ByVal EndState As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal startState As Single = -1.0F)
If CurrentEntity Is Nothing Then
Logger.Log(Logger.LogTypes.Warning, "ATTEMPT TO USE AttackSpawnMovingAnimation OUTSIDE OF ATTACK ANIMATION DELEGATE")
ElseIf Not AnimationStarted Then
Logger.Log(Logger.LogTypes.Warning, "ATTEMPT TO USE AttackSpawnMovingAnimation BEFORE CALLING AnimationSequenceBegin")
Else
If startState = -1.0F Then startState = CurrentEntity.Opacity
Dim baBillOpacity As BABillOpacity = New BABillOpacity(CurrentEntity, TransitionSpeed, FadeIn, EndState, startDelay, endDelay, startState)
AnimationSequence.Add(baBillOpacity)
If Me.CurrentModel IsNot Nothing Then
Dim baModelOpacity As BABillOpacity = New BABillOpacity(CType(CurrentModel, Entity), TransitionSpeed, FadeIn, EndState, startDelay, endDelay, startState)
AnimationSequence.Add(baModelOpacity)
End If
End If
End Sub
Public Sub AnimationPlaySound(ByVal sound As String, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal stopMusic As Boolean = False, Optional ByVal IsPokemon As Boolean = False)
If CurrentEntity Is Nothing Then
Logger.Log(Logger.LogTypes.Warning, "ATTEMPT TO USE AnimationPlaySound OUTSIDE OF ATTACK ANIMATION DELEGATE")
@ -191,52 +250,5 @@
End If
End Sub
Public Sub AnimationSpawnScalingEntity(ByVal PositionX As Single, ByVal PositionY As Single, ByVal PositionZ As Single, ByVal Texture As String, ByVal ScaleX As Single, ByVal ScaleY As Single, ByVal ScaleZ As Single, ByVal Grow As Boolean, ByVal EndSizeX As Single, ByVal EndSizeY As Single, ByVal EndSizeZ As Single, ByVal SizeSpeed As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal Anchors As String = "1")
If CurrentEntity Is Nothing Then
Logger.Log(Logger.LogTypes.Warning, "ATTEMPT TO USE AttackSpawnSizeAnimation OUTSIDE OF ATTACK ANIMATION DELEGATE")
ElseIf Not AnimationStarted Then
Logger.Log(Logger.LogTypes.Warning, "ATTEMPT TO USE AttackSpawnSizeAnimation BEFORE CALLING AnimationSequenceBegin")
Else
Dim stringArray = Texture.Split(","c)
Dim texture2D As Texture2D = Nothing
If stringArray.Length = 1 Then
texture2D = TextureManager.GetTexture(Texture)
ElseIf stringArray.Length = 5 Then
Dim r As Rectangle = New Rectangle(CInt(stringArray(1)), CInt(stringArray(2)), CInt(stringArray(3)), CInt(stringArray(4)))
texture2D = TextureManager.GetTexture(stringArray(0), r, "")
End If
If BAFlipped Then
PositionX -= PositionX * 2.0F
PositionZ -= PositionZ * 2.0F
End If
Dim Position As Vector3 = New Vector3(CurrentEntity.Position.X + PositionX, CurrentEntity.Position.Y + PositionY, CurrentEntity.Position.Z + PositionZ)
Dim Scale As Vector3 = New Vector3(ScaleX, ScaleY, ScaleZ)
Dim EndSize As Vector3 = New Vector3(EndSizeX, EndSizeY, EndSizeZ)
Dim baSize As BASize = New BASize(Position, texture2D, Scale, Grow, EndSize, SizeSpeed, startDelay, endDelay, Anchors)
AnimationSequence.Add(baSize)
End If
End Sub
Public Sub AnimationScalePokemonEntity(ByVal entity As Entity, ByVal PositionX As Single, ByVal PositionY As Single, ByVal PositionZ As Single, ByVal Texture As String, ByVal ScaleX As Single, ByVal ScaleY As Single, ByVal ScaleZ As Single, ByVal Grow As Boolean, ByVal EndSizeX As Single, ByVal EndSizeY As Single, ByVal EndSizeZ As Single, ByVal SizeSpeed As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal Anchors As String = "1")
If CurrentEntity Is Nothing Then
Logger.Log(Logger.LogTypes.Warning, "ATTEMPT TO USE AttackSpawnSizeAnimation OUTSIDE OF ATTACK ANIMATION DELEGATE")
ElseIf Not AnimationStarted Then
Logger.Log(Logger.LogTypes.Warning, "ATTEMPT TO USE AttackSpawnSizeAnimation BEFORE CALLING AnimationSequenceBegin")
Else
Dim stringArray = Texture.Split(","c)
If BAFlipped Then
PositionX -= PositionX * 2.0F
PositionZ -= PositionZ * 2.0F
End If
Dim Position As Vector3 = New Vector3(CurrentEntity.Position.X + PositionX, CurrentEntity.Position.Y + PositionY, CurrentEntity.Position.Z + PositionZ)
Dim Scale As Vector3 = New Vector3(ScaleX, ScaleY, ScaleZ)
Dim EndSize As Vector3 = New Vector3(EndSizeX, EndSizeY, EndSizeZ)
Dim baBillSize As BABillSize = New BABillSize(entity, Scale, Grow, EndSize, SizeSpeed, startDelay, endDelay, Anchors)
AnimationSequence.Add(baBillSize)
End If
End Sub
End Class
End Namespace

View File

Before

Width:  |  Height:  |  Size: 303 B

After

Width:  |  Height:  |  Size: 303 B

View File

@ -15394,7 +15394,7 @@
<Content Include="Content\Textures\Battle\Normal\Tackle.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Textures\Battle\Other\Star.png">
<Content Include="Content\Textures\Battle\BallCatchStar.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Textures\Battle\Poison\Bubble.png">
@ -27545,9 +27545,11 @@
<Content Include="credits.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Compile Include="Battle\BattleAnimations\BABillMove.vb" />
<Compile Include="Battle\BattleAnimations\BABillOpacity.vb" />
<Compile Include="Battle\BattleAnimations\BABillSize.vb" />
<Compile Include="Battle\BattleAnimations\BAEntityRotate.vb" />
<Compile Include="Battle\BattleAnimations\BAEntityMove.vb" />
<Compile Include="Battle\BattleAnimations\BAEntityOpacity.vb" />
<Compile Include="Battle\BattleAnimations\BAEntityTextureChange.vb" />
<Compile Include="Battle\BattleAnimations\BAEntityScale.vb" />
<Compile Include="Battle\BattleAnimations\BASound.vb" />
<Compile Include="Battle\BattleSystemV2\QueryObjects\AnimationQueryObject.vb" />
<Compile Include="Dialogues\ImageView.vb" />
@ -29229,7 +29231,6 @@
<Compile Include="Battle\BattleAnimations\BAMove.vb" />
<Compile Include="Battle\BattleAnimations\BAOpacity.vb" />
<Compile Include="Battle\BattleAnimations\BARotation.vb" />
<Compile Include="Battle\BattleAnimations\BASize.vb" />
<Compile Include="Battle\BattleAnimations\BattleAnimation3D.vb" />
<Compile Include="Battle\BattleStats.vb" />
<Compile Include="Battle\BattleSystemV2\Battle.vb" />

View File

@ -54,8 +54,8 @@
Public Overrides Sub InternalUserPokemonMoveAnimation(ByVal BattleScreen As BattleScreen, ByVal own As Boolean, ByVal CurrentPokemon As Pokemon, ByVal CurrentEntity As NPC, ByVal CurrentModel As ModelEntity)
Dim MoveAnimation As AnimationQueryObject = New AnimationQueryObject(CurrentEntity, own, CurrentModel)
MoveAnimation.AnimationMovePokemonEntity(0.5, 0, 0, 0.3, False, False, 0, 0,,, 2)
MoveAnimation.AnimationMovePokemonEntity(0, 0, 0, 0.3, False, False, 1, 0,,, 2)
MoveAnimation.AnimationMoveEntity(Nothing, 0.5, 0, 0, 0.3, False, False, 0, 0,,, 2)
MoveAnimation.AnimationMoveEntity(Nothing, 0, 0, 0, 0.3, False, False, 1, 0,,, 2)
BattleScreen.BattleQuery.Add(MoveAnimation)
End Sub

View File

@ -3,10 +3,13 @@
Inherits Screen
Dim Ball As Item
Dim Animations As New List(Of BattleAnimation3D)
Dim Animations As BattleSystem.AnimationQueryObject = New BattleSystem.AnimationQueryObject(Nothing, False, Nothing)
Dim BallStartPosition As Vector3 = New Vector3(Camera.Position.X - 1.0F, Camera.Position.Y, Camera.Position.Z - 0.5F) + BattleScreen.BattleMapOffset
Dim BallEntity As Entity = Animations.SpawnEntity(BallStartPosition, Ball.Texture, New Vector3(0.3F), 1.0F)
Dim AnimationStarted As Boolean = False
Dim catched As Boolean = False
Dim caught As Boolean = False
Dim InBall As Boolean = False
Dim AnimationIndex As Integer = 0
Dim renamed As Boolean = False
@ -49,9 +52,6 @@
Level.Draw()
Dim RenderObjects As New List(Of Entity)
For Each a As BattleAnimation3D In Me.Animations
RenderObjects.Add(a)
Next
If InBall = False Then
RenderObjects.Add(BattleScreen.OppPokemonNPC)
@ -65,29 +65,15 @@
[Object].Render()
Next
Animations.Draw(CType(Me.PreScreen, BattleSystem.BattleScreen))
World.DrawWeather(Screen.Level.World.CurrentMapWeather)
TextBox.Draw()
End Sub
Private Sub UpdateAnimations()
Animations = (From a In Animations Order By a.CameraDistance Descending).ToList()
For i = 0 To Animations.Count - 1
If i <= Animations.Count - 1 Then
Dim a As BattleAnimation3D = Animations(i)
If a.CanRemove = True Then
i -= 1
Animations.Remove(a)
Else
a.Update()
End If
End If
Next
For Each Animation As BattleAnimation3D In Animations
Animation.UpdateEntity()
Next
Animations.Update(CType(Me.PreScreen, BattleSystem.BattleScreen))
End Sub
Private Sub SetCamera()
@ -129,75 +115,72 @@
If AnimationStarted = False Then
SetupAnimation()
Else
If Me.Animations.Count = 0 Then
Select Case Me.AnimationIndex
Case 0
Select Case Me.AnimationIndex
Case 0
SoundManager.PlaySound("Battle\Pokeball\open")
InBall = True
AnimationIndex = 1
AnimationStarted = False
SetupAnimation()
Case 1
AnimationIndex = 2
AnimationStarted = False
SetupAnimation()
Case 2, 3, 4, 5
If StayInBall() = True Then
SoundManager.PlaySound("Battle\Pokeball\shake")
AnimationIndex += 1
Else
SoundManager.PlaySound("Battle\Pokeball\open")
InBall = True
AnimationIndex = 1
AnimationStarted = False
SetupAnimation()
Case 1
AnimationIndex = 2
AnimationStarted = False
SetupAnimation()
Case 2, 3, 4, 5
If StayInBall() = True Then
SoundManager.PlaySound("Battle\Pokeball\shake")
AnimationIndex += 1
Else
SoundManager.PlaySound("Battle\Pokeball\break")
AnimationIndex = 21
InBall = False
End If
AnimationStarted = False
SetupAnimation()
Case 6
AnimationIndex = 7
AnimationStarted = False
SetupAnimation()
SoundManager.PlaySound("Battle\Pokeball\catch", False)
Case 7
AnimationIndex = 8
AnimationStarted = False
SetupAnimation()
CatchPokemon()
BattleSystem.Battle.Caught = True
Case 8
AnimationIndex = 9
If showPokedexEntry = True Then
Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New PokedexViewScreen(Core.CurrentScreen, p, True), Color.White, False))
End If
Case 9
AnimationIndex = 10
Core.SetScreen(New NameObjectScreen(Core.CurrentScreen, p))
Case 10 ' After Catch
If p.CatchBall.ID = 186 Then
p.FullRestore() ' Heal Ball
End If
AnimationIndex = 21
InBall = False
End If
AnimationStarted = False
SetupAnimation()
Case 6
AnimationIndex = 7
AnimationStarted = False
SetupAnimation()
Case 7
AnimationIndex = 8
AnimationStarted = False
SetupAnimation()
CatchPokemon()
BattleSystem.Battle.Caught = True
Case 8
AnimationIndex = 9
If showPokedexEntry = True Then
Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New PokedexViewScreen(Core.CurrentScreen, p, True), Color.White, False))
End If
Case 9
AnimationIndex = 10
Core.SetScreen(New NameObjectScreen(Core.CurrentScreen, p))
Case 10 ' After Catch
If p.CatchBall.ID = 186 Then
p.FullRestore() ' Heal Ball
End If
PlayerStatistics.Track("Caught Pokemon", 1)
StorePokemon()
AnimationIndex = 11
Case 11
Core.SetScreen(Me.PreScreen)
BattleSystem.Battle.Won = True
CType(Core.CurrentScreen, BattleSystem.BattleScreen).EndBattle(False)
Case 20 ' Failed
If Core.Player.Pokemons.Count < 6 Then
Dim p As Pokemon = BattleScreen.OppPokemon
p.SetCatchInfos(Me.Ball, "Illegally caught!")
PlayerStatistics.Track("Caught Pokemon", 1)
StorePokemon()
AnimationIndex = 11
Case 11
Core.SetScreen(Me.PreScreen)
BattleSystem.Battle.Won = True
CType(Core.CurrentScreen, BattleSystem.BattleScreen).EndBattle(False)
Case 20 ' Failed
If Core.Player.Pokemons.Count < 6 Then
Dim p As Pokemon = BattleScreen.OppPokemon
p.SetCatchInfos(Me.Ball, "Illegally caught!")
Core.Player.Pokemons.Add(p)
End If
ResetVisibility()
Core.SetScreen(Me.PreScreen)
Case 21 ' After Break
ResetVisibility()
Core.SetScreen(Me.PreScreen)
CType(Core.CurrentScreen, BattleSystem.BattleScreen).Battle.InitializeRound(CType(Core.CurrentScreen, BattleSystem.BattleScreen), New BattleSystem.Battle.RoundConst() With {.StepType = BattleSystem.Battle.RoundConst.StepTypes.Text, .Argument = "It broke free!"})
End Select
End If
Core.Player.Pokemons.Add(p)
End If
ResetVisibility()
Core.SetScreen(Me.PreScreen)
Case 21 ' After Break
ResetVisibility()
Core.SetScreen(Me.PreScreen)
CType(Core.CurrentScreen, BattleSystem.BattleScreen).Battle.InitializeRound(CType(Core.CurrentScreen, BattleSystem.BattleScreen), New BattleSystem.Battle.RoundConst() With {.StepType = BattleSystem.Battle.RoundConst.StepTypes.Text, .Argument = "It broke free!"})
End Select
End If
End If
End If
@ -272,29 +255,51 @@
Select Case Me.AnimationIndex
Case 0
Animations.Add(New BAMove(New Vector3(Camera.Position.X - 1.0F, Camera.Position.Y, Camera.Position.Z - 0.5F) + BattleScreen.BattleMapOffset, Ball.Texture, New Vector3(0.3F), New Vector3(BattleScreen.OppPokemonNPC.Position.X - 0.05F, 0.0F, BattleScreen.OppPokemonNPC.Position.Z), 0.04F, True, True, 1.0F, 0.0F,,, 3))
Animations.AnimationMoveEntity(BallEntity, BattleScreen.OppPokemonNPC.Position.X - 0.05F, 0.0F, BattleScreen.OppPokemonNPC.Position.Z, 0.04F, True, True, 1.0F, 0.0F,,, 3)
Case 1
BattleScreen.OppPokemonNPC.Visible = False
Animations.Add(New BAMove(New Vector3(BattleScreen.OppPokemonNPC.Position.X - 0.05F, 0.0F, BattleScreen.OppPokemonNPC.Position.Z), Ball.Texture, New Vector3(0.3F), New Vector3(BattleScreen.OppPokemonNPC.Position.X - 0.05F, 0.0F, BattleScreen.OppPokemonNPC.Position.Z), 0.01F, False, False, 0.0F, 6.0F,,, 3))
Dim SmokeReturned As Integer = 0
Do
Dim SmokePosition = New Vector3(CSng(Random.Next(-10, 10) / 10), CSng(Random.Next(-10, 10) / 10), CSng(Random.Next(-10, 10) / 10))
Dim SmokeDestination = New Vector3(0, 0, 0)
Dim Size As New BASize(BattleScreen.OppPokemonNPC.Position, BattleScreen.OppPokemonNPC.Textures(0), BattleScreen.OppPokemonNPC.Scale, False, New Vector3(0.05F), 0.02F, 0.0F, 0.0F, "1")
Dim SmokeTexture As Texture2D = TextureManager.GetTexture("Textures\Battle\Cloud")
Animations.Add(Size)
Dim SmokeScale = New Vector3(CSng(Random.Next(2, 6) / 10))
Dim SmokeSpeed = CSng(Random.Next(1, 3) / 10.0F)
Dim SmokeEntity As Entity = Animations.SpawnEntity(SmokePosition, SmokeTexture, SmokeScale, 1.0F)
Animations.AnimationMoveEntity(SmokeEntity, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 0.0F, 0.0F)
If SmokeEntity.Position = SmokeDestination Then
Animations.RemoveEntity(SmokeEntity)
End If
Threading.Interlocked.Increment(SmokeReturned)
Loop While SmokeReturned <= 38
Animations.AnimationMoveEntity(BallEntity, BattleScreen.OppPokemonNPC.Position.X - 0.05F, 0.0F, BattleScreen.OppPokemonNPC.Position.Z, 0.01F, False, False, 0.0F, 6.0F,,, 3)
Animations.AnimationScaleEntity(BattleScreen.OppPokemonNPC, False, 0.05F, 0.05F, 0.05F, 0.02F, 0.0F, 0.0F, "1")
Animations.AnimationFadeEntity(BattleScreen.OppPokemonNPC, 1, False, 0.0F, 0.0F, 0.0F)
Case 2
Animations.Add(New BAMove(New Vector3(BattleScreen.OppPokemonNPC.Position.X - 0.05F, 0.0F, BattleScreen.OppPokemonNPC.Position.Z), Ball.Texture, New Vector3(0.3F), New Vector3(BattleScreen.OppPokemonNPC.Position.X - 0.05F, -0.35F, BattleScreen.OppPokemonNPC.Position.Z), 0.02F, False, False, 0.0F, 6.0F,,, 3))
Animations.AnimationMoveEntity(BallEntity, BattleScreen.OppPokemonNPC.Position.X - 0.05F, -0.35F, BattleScreen.OppPokemonNPC.Position.Z, 0.02F, False, False, 0.0F, 6.0F,,, 3)
Case 3, 5
Animations.Add(New BARotation(New Vector3(BattleScreen.OppPokemonNPC.Position.X - 0.05F, -0.35F, BattleScreen.OppPokemonNPC.Position.Z), Ball.Texture, New Vector3(0.3F), New Vector3(0, 0, 0.05F), New Vector3(0, 0, 1.0F), 0.0F, 4.0F, False, False, True, True))
Animations.AnimationRotateEntity(BallEntity, 0, 0, 0.05F, 0, 0, 1.0F, 0.0F, 4.0F, False, False, True, True)
Case 4, 6
Animations.Add(New BARotation(New Vector3(BattleScreen.OppPokemonNPC.Position.X - 0.05F, -0.35F, BattleScreen.OppPokemonNPC.Position.Z), Ball.Texture, New Vector3(0.3F), New Vector3(0, 0, -0.05F), New Vector3(0, 0, -1.0F), 0.0F, 4.0F, False, False, True, True))
Animations.AnimationRotateEntity(BallEntity, 0, 0, -0.05F, 0, 0, -1.0F, 0.0F, 4.0F, False, False, True, True)
Case 7 ' Catch Animation
For i = 0 To 2
Dim v As Vector3 = New Vector3(BattleScreen.OppPokemonNPC.Position.X - 0.05F, -0.35F, BattleScreen.OppPokemonNPC.Position.Z)
Animations.Add(New BAMove(v, TextureManager.GetTexture("Textures\Battle\Other\Star"), New Vector3(0.1F), New Vector3(v.X, v.Y + 0.4F, v.Z - ((1 - i) * 0.4F)), 0.01F, False, False, 0.0F, 0.0F,,, 3))
Dim StarPosition As Vector3 = New Vector3(BattleScreen.OppPokemonNPC.Position.X - 0.05F, -0.35F, BattleScreen.OppPokemonNPC.Position.Z)
Dim StarDestination As Vector3 = New Vector3(StarPosition.X, StarPosition.Y + 0.4F, StarPosition.Z - ((1 - i) * 0.4F))
Dim StarEntity As Entity = Animations.SpawnEntity(StarPosition, TextureManager.GetTexture("Textures\Battle\BallCatchStar"), New Vector3(0.1F), 1.0F)
Animations.AnimationMoveEntity(StarEntity, StarDestination.X, StarDestination.Y, StarDestination.Z, 0.01F, False, False, 0.0F, 0.0F,,, 3)
If StarEntity.Position = StarDestination Then
Animations.RemoveEntity(StarEntity)
End If
Next
Animations.Add(New BAMove(New Vector3(BattleScreen.OppPokemonNPC.Position.X - 0.05F, -0.35F, BattleScreen.OppPokemonNPC.Position.Z), Ball.Texture, New Vector3(0.3F), New Vector3(BattleScreen.OppPokemonNPC.Position.X - 0.05F, -0.35F, BattleScreen.OppPokemonNPC.Position.Z), 0.02F, False, False, 0.0F, 6.0F,,, 3))
Animations.AnimationMoveEntity(BallEntity, BattleScreen.OppPokemonNPC.Position.X - 0.05F, -0.35F, BattleScreen.OppPokemonNPC.Position.Z, 0.02F, False, False, 0.0F, 6.0F,,, 3)
Case 8
Animations.Add(New BAOpacity(New Vector3(BattleScreen.OppPokemonNPC.Position.X - 0.05F, -0.35F, BattleScreen.OppPokemonNPC.Position.Z), Ball.Texture, New Vector3(0.3F), 0.01F, False, 0.0F, 0.0F, 0.0F))
Animations.AnimationFadeEntity(BallEntity, 0.01F, False, 0.0F, 0.0F, 0.0F)
Case 21 ' Break Animation
End Select