diff --git a/P3D/Battle/BattleAnimations/BAEntityColor.vb b/P3D/Battle/BattleAnimations/BAEntityColor.vb new file mode 100644 index 000000000..75ba229d4 --- /dev/null +++ b/P3D/Battle/BattleAnimations/BAEntityColor.vb @@ -0,0 +1,67 @@ +Public Class BAEntityColor + + Inherits BattleAnimation3D + + Public TargetEntity As Entity + Public TransitionSpeed As Single = 0.01F + Public FadeIn As Boolean = False + Public ColorTo As Vector3 = New Vector3(1.0F, 1.0F, 1.0F) + + Public Sub New(ByVal Entity As Entity, ByVal TransitionSpeed As Single, ByVal startDelay As Single, ByVal endDelay As Single, ByVal ColorTo As Color, Optional ByVal ColorFrom As Color = Nothing) + MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay) + + Me.TransitionSpeed = TransitionSpeed + Me.TargetEntity = Entity + + If Not ColorFrom = Nothing Then + TargetEntity.Color = ColorFrom.ToVector3 + End If + Me.ColorTo = ColorTo.ToVector3 + + Me.Visible = False + + Me.AnimationType = AnimationTypes.Transition + End Sub + + Public Overrides Sub DoActionActive() + + If TargetEntity.Color.X > ColorTo.X Then + TargetEntity.Color.X -= CByte(Me.TransitionSpeed) + If TargetEntity.Color.X <= ColorTo.X Then + TargetEntity.Color.X = ColorTo.X + End If + ElseIf TargetEntity.Color.X < ColorTo.X Then + TargetEntity.Color.X += CByte(Me.TransitionSpeed) + If TargetEntity.Color.X >= ColorTo.X Then + TargetEntity.Color.X = ColorTo.X + End If + End If + If TargetEntity.Color.Y > ColorTo.Y Then + TargetEntity.Color.Y -= CByte(Me.TransitionSpeed) + If TargetEntity.Color.Y <= ColorTo.Y Then + TargetEntity.Color.Y = ColorTo.Y + End If + ElseIf TargetEntity.Color.Y < ColorTo.Y Then + TargetEntity.Color.Y += CByte(Me.TransitionSpeed) + If TargetEntity.Color.Y >= ColorTo.Y Then + TargetEntity.Color.Y = ColorTo.Y + End If + End If + If TargetEntity.Color.Z > ColorTo.Z Then + TargetEntity.Color.Z -= CByte(Me.TransitionSpeed) + If TargetEntity.Color.Z <= ColorTo.Z Then + TargetEntity.Color.Z = ColorTo.Z + End If + ElseIf TargetEntity.Color.Z < ColorTo.Z Then + TargetEntity.Color.Z += CByte(Me.TransitionSpeed) + If TargetEntity.Color.Z >= ColorTo.Z Then + TargetEntity.Color.Z = ColorTo.Z + End If + End If + + If TargetEntity.Color = ColorTo Then + Me.Ready = True + End If + End Sub + +End Class \ No newline at end of file diff --git a/P3D/Battle/BattleAnimations/BAEntityScale.vb b/P3D/Battle/BattleAnimations/BAEntityScale.vb index 24d1245ea..1e687de4c 100644 --- a/P3D/Battle/BattleAnimations/BAEntityScale.vb +++ b/P3D/Battle/BattleAnimations/BAEntityScale.vb @@ -6,7 +6,7 @@ Public EndSize As Vector3 Public SizeSpeed As Single = 0.01F Public TargetEntity As Entity - Public Anchors As String + Public Anchors As String '1 = Bottom, 2 = Top, 3 = Left, 4 = Right. Combinations are possible. Public Change As New Vector3(1) diff --git a/P3D/Battle/BattleAnimations/BAMove.vb b/P3D/Battle/BattleAnimations/BAMove.vb deleted file mode 100644 index e59c0f0e5..000000000 --- a/P3D/Battle/BattleAnimations/BAMove.vb +++ /dev/null @@ -1,194 +0,0 @@ -Public Class BAMove - - Inherits BattleAnimation3D - - Public Destination As Vector3 - Public MoveSpeed As Single - Public SpinX As Boolean = False - Public SpinZ As Boolean = False - - Public InterpolationSpeed As Single - Public SpinSpeedX As Single = 0.1F - Public SpinSpeedZ As Single = 0.1F - Public MovementCurve As Integer = 3 - - Private EasedIn As Boolean = False - Private EasedOut As Boolean = False - Public Enum Curves As Integer - EaseIn - EaseOut - EaseInAndOut - Linear - End Enum - Public Sub New(ByVal Position As Vector3, ByVal Texture As Texture2D, ByVal Scale As Vector3, 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 = 2) - MyBase.New(Position, Texture, Scale, startDelay, endDelay) - - Me.Position = Position - Me.Destination = Destination - Me.MovementCurve = CType(MovementCurve, Curves) - - Me.MoveSpeed = Speed - Me.Scale = Scale - Me.SpinSpeedX = SpinXSpeed - Me.SpinSpeedZ = SpinZSpeed - - Me.SpinX = SpinX - Me.SpinZ = SpinZ - - Select Case MovementCurve - Case Curves.EaseIn - InterpolationSpeed = 0.0F - Case Curves.EaseOut - InterpolationSpeed = MoveSpeed - Case Curves.EaseInAndOut - InterpolationSpeed = 0.0F - Case Curves.Linear - InterpolationSpeed = MoveSpeed - End Select - - Me.AnimationType = AnimationTypes.Move - End Sub - - Public Sub New(ByVal Position As Vector3, ByVal Texture As Texture2D, ByVal Scale As Vector3, ByVal Destination As Vector3, ByVal Speed As Single, ByVal startDelay As Single, ByVal endDelay As Single) - Me.New(Position, Texture, Scale, Destination, Speed, False, False, startDelay, endDelay, 0.1, 0.1, 2) - End Sub - - Public Overrides Sub DoActionUpdate() - Spin() - End Sub - - Public Overrides Sub DoActionActive() - Move() - End Sub - - Private Sub Spin() - If Me.SpinX = True Then - Me.Rotation.X += SpinSpeedX - End If - If Me.SpinZ = True Then - Me.Rotation.Z += SpinSpeedZ - End If - End Sub - - Private Sub Move() - Select Case MovementCurve - Case Curves.EaseIn - If EasedIn = False Then - If InterpolationSpeed < MoveSpeed Then - InterpolationSpeed += MoveSpeed / 10 - Else - EasedIn = True - InterpolationSpeed = MoveSpeed - End If - End If - Case Curves.EaseOut - If EasedOut = False Then - If InterpolationSpeed > 0 Then - InterpolationSpeed -= MoveSpeed / 10 - Else - EasedOut = True - InterpolationSpeed = 0 - End If - End If - Case Curves.EaseInAndOut - If EasedIn = False Then - If InterpolationSpeed < MoveSpeed Then - InterpolationSpeed += MoveSpeed / 10 - Else - EasedIn = True - InterpolationSpeed = MoveSpeed - End If - Else - If EasedOut = False Then - If InterpolationSpeed > 0 Then - InterpolationSpeed -= MoveSpeed / 10 - Else - EasedOut = True - InterpolationSpeed = 0 - End If - End If - End If - End Select - If MovementCurve = Curves.Linear Then - If Me.Position.X < Me.Destination.X Then - Me.Position.X += Me.MoveSpeed - - If Me.Position.X >= Me.Destination.X Then - Me.Position.X = Me.Destination.X - End If - ElseIf Me.Position.X > Me.Destination.X Then - Me.Position.X -= Me.MoveSpeed - - If Me.Position.X <= Me.Destination.X Then - Me.Position.X = Me.Destination.X - End If - End If - If Me.Position.Y < Me.Destination.Y Then - Me.Position.Y += Me.MoveSpeed - - If Me.Position.Y >= Me.Destination.Y Then - Me.Position.Y = Me.Destination.Y - End If - ElseIf Me.Position.Y > Me.Destination.Y Then - Me.Position.Y -= Me.MoveSpeed - - If Me.Position.Y <= Me.Destination.Y Then - Me.Position.Y = Me.Destination.Y - End If - End If - If Me.Position.Z < Me.Destination.Z Then - Me.Position.Z += Me.MoveSpeed - - If Me.Position.Z >= Me.Destination.Z Then - Me.Position.Z = Me.Destination.Z - End If - ElseIf Me.Position.Z > Me.Destination.Z Then - Me.Position.Z -= Me.MoveSpeed - - If Me.Position.Z <= Me.Destination.Z Then - Me.Position.Z = Me.Destination.Z - End If - End If - Else - If Me.Position.X < Me.Destination.X Then - Me.Position.X = MathHelper.Lerp(Me.Position.X, Me.Destination.X, Me.InterpolationSpeed) - If Me.Position.X > Me.Destination.X - 0.05 Then - Me.Position.X = Me.Destination.X - End If - ElseIf Me.Position.X > Me.Destination.X Then - Me.Position.X = MathHelper.Lerp(Me.Position.X, Me.Destination.X, Me.InterpolationSpeed) - If Me.Position.X < Me.Destination.X + 0.05 Then - Me.Position.X = Me.Destination.X - End If - End If - If Me.Position.Y < Me.Destination.Y Then - Me.Position.Y = MathHelper.Lerp(Me.Position.Y, Me.Destination.Y, Me.InterpolationSpeed) - If Me.Position.Y > Me.Destination.Y - 0.05 Then - Me.Position.Y = Me.Destination.Y - End If - ElseIf Me.Position.Y > Me.Destination.Y Then - Me.Position.Y = MathHelper.Lerp(Me.Position.Y, Me.Destination.Y, Me.InterpolationSpeed) - If Me.Position.Y < Me.Destination.Y + 0.05 Then - Me.Position.Y = Me.Destination.Y - End If - End If - If Me.Position.Z < Me.Destination.Z Then - Me.Position.Z = MathHelper.Lerp(Me.Position.Z, Me.Destination.Z, Me.InterpolationSpeed) - If Me.Position.Z > Me.Destination.Z - 0.05 Then - Me.Position.Z = Me.Destination.Z - End If - ElseIf Me.Position.Z > Me.Destination.Z Then - Me.Position.Z = MathHelper.Lerp(Me.Position.Z, Me.Destination.Z, Me.InterpolationSpeed) - If Me.Position.Z < Me.Destination.Z + 0.05 Then - Me.Position.Z = Me.Destination.Z - End If - End If - End If - - If Me.Position = Destination Then - Me.Ready = True - End If - - End Sub - -End Class \ No newline at end of file diff --git a/P3D/Battle/BattleAnimations/BAOpacity.vb b/P3D/Battle/BattleAnimations/BAOpacity.vb deleted file mode 100644 index 5326dcea2..000000000 --- a/P3D/Battle/BattleAnimations/BAOpacity.vb +++ /dev/null @@ -1,41 +0,0 @@ -Public Class BAOpacity - - Inherits BattleAnimation3D - - Public TransitionSpeed As Single = 0.01F - Public FadeIn As Boolean = False - Public EndState As Single = 0.0F - - Public Sub New(ByVal Position As Vector3, ByVal Texture As Texture2D, ByVal Scale As Vector3, 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) - MyBase.New(Position, Texture, Scale, startDelay, endDelay) - MyBase.Opacity = StartState - Me.EndState = EndState - Me.FadeIn = FadeIn - Me.TransitionSpeed = TransitionSpeed - - Me.AnimationType = AnimationTypes.Transition - End Sub - - Public Overrides Sub DoActionActive() - If Me.FadeIn = True Then - If Me.EndState > Me.Opacity Then - Me.Opacity += Me.TransitionSpeed - If Me.Opacity >= Me.EndState Then - Me.Opacity = Me.EndState - End If - End If - Else - If Me.EndState < Me.Opacity Then - Me.Opacity -= Me.TransitionSpeed - If Me.Opacity <= Me.EndState Then - Me.Opacity = Me.EndState - End If - End If - End If - - If Me.Opacity = Me.EndState Then - Me.Ready = True - End If - End Sub - -End Class \ No newline at end of file diff --git a/P3D/Battle/BattleAnimations/BARotation.vb b/P3D/Battle/BattleAnimations/BARotation.vb deleted file mode 100644 index 13f921a10..000000000 --- a/P3D/Battle/BattleAnimations/BARotation.vb +++ /dev/null @@ -1,129 +0,0 @@ -Public Class BARotation - - Inherits BattleAnimation3D - - Dim RotationVector 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 Position As Vector3, ByVal Texture As Texture2D, ByVal Scale As Vector3, ByVal RotationVector As Vector3, ByVal EndRotation As Vector3, ByVal startDelay As Single, ByVal endDelay As Single) - MyBase.New(Position, Texture, Scale, startDelay, endDelay) - - Me.RotationVector = RotationVector - Me.EndRotation = EndRotation - Me.ReturnVector = Me.Rotation - End Sub - - Public Sub New(ByVal Position As Vector3, ByVal Texture As Texture2D, ByVal Scale As Vector3, ByVal RotationVector 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(Position, Texture, Scale, RotationVector, 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 Position As Vector3, ByVal Texture As Texture2D, ByVal Scale As Vector3, ByVal RotationVector 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(Position, Texture, Scale, RotationVector, 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 Me.Rotation.X > Me.EndRotation.X Then - Me.Rotation.X += Me.RotationVector.X - - If Me.Rotation.X <= Me.EndRotation.X Then - Me.Rotation.X = Me.EndRotation.X - End If - ElseIf Me.Rotation.X < Me.EndRotation.X Then - Me.Rotation.X += Me.RotationVector.X - - If Me.Rotation.X >= Me.EndRotation.X Then - Me.Rotation.X = Me.EndRotation.X - End If - End If - End If - - If DoRotation.Y = 1.0F Then - If Me.Rotation.Y > Me.EndRotation.Y Then - Me.Rotation.Y += Me.RotationVector.Y - - If Me.Rotation.Y <= Me.EndRotation.Y Then - Me.Rotation.Y = Me.EndRotation.Y - End If - ElseIf Me.Rotation.Y < Me.EndRotation.Y Then - Me.Rotation.Y += Me.RotationVector.Y - - If Me.Rotation.Y >= Me.EndRotation.Y Then - Me.Rotation.Y = Me.EndRotation.Y - End If - End If - End If - - If DoRotation.Z = 1.0F Then - If Me.Rotation.Z > Me.EndRotation.Z Then - Me.Rotation.Z += Me.RotationVector.Z - - If Me.Rotation.Z <= Me.EndRotation.Z Then - Me.Rotation.Z = Me.EndRotation.Z - End If - ElseIf Me.Rotation.Z < Me.EndRotation.Z Then - Me.Rotation.Z += Me.RotationVector.Z - - If Me.Rotation.Z >= Me.EndRotation.Z Then - Me.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.RotationVector = New Vector3(Me.RotationVector.X * -1, Me.RotationVector.Y * -1, Me.RotationVector.Z * -1) - Else - Me.Ready = True - End If - End Sub - - Private Function VectorReached() As Boolean - If DoRotation.X = 1.0F Then - If EndRotation.X <> Me.Rotation.X Then - Return False - End If - End If - If DoRotation.Y = 1.0F Then - If EndRotation.Y <> Me.Rotation.Y Then - Return False - End If - End If - If DoRotation.Z = 1.0F Then - If EndRotation.Z <> Me.Rotation.Z Then - Return False - End If - End If - - Return True - End Function - -End Class \ No newline at end of file diff --git a/P3D/Battle/BattleAnimations/BASound.vb b/P3D/Battle/BattleAnimations/BASound.vb deleted file mode 100644 index da699ec23..000000000 --- a/P3D/Battle/BattleAnimations/BASound.vb +++ /dev/null @@ -1,28 +0,0 @@ -Public Class BASound - - Inherits BattleAnimation3D - - Private soundfile As String - Private stopMusic As Boolean - Private IsPokemon As Boolean - - - Public Sub New(ByVal sound As String, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal stopMusic As Boolean = False, Optional ByVal IsPokemon As Boolean = False) - MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay) - Me.Scale = New Vector3(1.0F) - soundfile = sound - Me.Visible = False - Me.stopMusic = stopMusic - Me.IsPokemon = IsPokemon - AnimationType = AnimationTypes.Sound - End Sub - - Public Overrides Sub DoActionActive() - If IsPokemon = True Then - SoundManager.PlayPokemonCry(CInt(soundfile)) - Else - SoundManager.PlaySound(soundfile, stopMusic) - End If - Me.Ready = True - End Sub -End Class \ No newline at end of file diff --git a/P3D/Battle/BattleAnimations/BattleAnimation3D.vb b/P3D/Battle/BattleAnimations/BattleAnimation3D.vb index 7d7c8050b..1aeb45e27 100644 --- a/P3D/Battle/BattleAnimations/BattleAnimation3D.vb +++ b/P3D/Battle/BattleAnimations/BattleAnimation3D.vb @@ -24,14 +24,19 @@ Public Ready As Boolean = False Public startDelay As Single Public endDelay As Single + Public SpawnedEntity As Entity = Nothing - Public Sub New(ByVal Position As Vector3, ByVal Texture As Texture2D, ByVal Scale As Vector3, ByVal startDelay As Single, ByVal endDelay As Single) + Public Sub New(ByVal Position As Vector3, ByVal Texture As Texture2D, ByVal Scale As Vector3, ByVal startDelay As Single, ByVal endDelay As Single, Optional SpawnedEntity As Entity = Nothing) MyBase.New(Position.X, Position.Y, Position.Z, "BattleAnimation", {Texture}, {0, 0}, False, 0, Scale, BaseModel.BillModel, 0, "", New Vector3(1.0F)) Me.Visible = Visible Me.startDelay = startDelay Me.endDelay = endDelay + If SpawnedEntity IsNot Nothing Then + Me.SpawnedEntity = SpawnedEntity + End If + Me.CreateWorldEveryFrame = True Me.DropUpdateUnlessDrawn = False End Sub @@ -56,6 +61,9 @@ startDelay = 0.0F End If Else + If SpawnedEntity IsNot Nothing Then + Ready = True + End If DoActionActive() End If End If diff --git a/P3D/Battle/BattleSystemV2/Battle.vb b/P3D/Battle/BattleSystemV2/Battle.vb index 823bea6f1..a93c5e4bc 100644 --- a/P3D/Battle/BattleSystemV2/Battle.vb +++ b/P3D/Battle/BattleSystemV2/Battle.vb @@ -2706,19 +2706,14 @@ ChangeCameraAngle(1, own, BattleScreen) 'Burn animation Dim BurnAnimation As AnimationQueryObject = New AnimationQueryObject(pNPC, own) - BurnAnimation.AnimationPlaySound("Battle\Effects\Burned", 0, 0) + BurnAnimation.PlaySound("Battle\Effects\Burned", 0, 0) 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) + BurnAnimation.ChangeEntityTexture(FlameEntity, False, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 32, 32, 32)), 2, 1) + BurnAnimation.ChangeEntityTexture(FlameEntity, False, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 64, 32, 32)), 3, 1) + BurnAnimation.ChangeEntityTexture(FlameEntity, False, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 96, 32, 32)), 4, 1) + BurnAnimation.ChangeEntityTexture(FlameEntity, True, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 128, 32, 32)), 5, 2) 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!")) @@ -2729,30 +2724,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 - - 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 - - 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 - - Return True + 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") + 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") + End If + End If + End If + + Return True End If + End If End If End If End If @@ -3421,19 +3416,18 @@ Dim maxAmount As Integer = 20 * val Dim currentAmount As Integer = 0 While currentAmount <= maxAmount - Dim Texture As String = "Textures\Battle\StatChange\statDown" - Dim Position As Vector3 = New Vector3(0, -0.4, 0) - Dim Destination As Vector3 = New Vector3(0, 0.8, 0) - Dim Scale As Vector3 = New Vector3(0.2F) + Dim Texture As Texture2D = TextureManager.GetTexture("Textures\Battle\StatChange\statUp") Dim xPos = CSng((Random.NextDouble() - 0.5) * 1.2) Dim zPos = CSng((Random.NextDouble() - 0.5) * 1.2) - Position.X = xPos - Position.Z = zPos - Destination.X = xPos - Destination.Z = zPos + Dim Position As New Vector3(xPos + pNPC.Position.X, CSng(pNPC.Position.Y - 0.4), pNPC.Position.Z + zPos) + Dim Destination As New Vector3(xPos + pNPC.Position.X, CSng(pNPC.Position.Y + 0.8), zPos + pNPC.Position.Z) + Dim Scale As New Vector3(0.2F) + + Dim StatEntity As Entity = StatAnimation.SpawnEntity(Position, Texture, Scale, 1.0F) Dim startDelay As Double = 5.0 * Random.NextDouble() - 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) + + StatAnimation.MoveEntity(Nothing, True, 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)) @@ -3699,27 +3693,26 @@ End If End If '***STAT DECREASE 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 - Dim Texture As String = "Textures\Battle\StatChange\statDown" - Dim Position As Vector3 = New Vector3(0, 0.8, 0) - Dim Destination As Vector3 = New Vector3(0, -0.4, 0) - Dim Scale As Vector3 = New Vector3(0.2F) + Dim Texture As Texture2D = TextureManager.GetTexture("Textures\Battle\StatChange\statDown") Dim xPos = CSng((Random.NextDouble() - 0.5) * 1.2) Dim zPos = CSng((Random.NextDouble() - 0.5) * 1.2) - Position.X = xPos - Position.Z = zPos - Destination.X = xPos - Destination.Z = zPos + Dim Position As New Vector3(xPos + pNPC.Position.X, CSng(pNPC.Position.Y + 0.8), pNPC.Position.Z + zPos) + Dim Destination As New Vector3(xPos + pNPC.Position.X, CSng(pNPC.Position.Y - 0.4), zPos + pNPC.Position.Z) + Dim Scale As New Vector3(0.2F) + + Dim StatEntity As Entity = StatAnimation.SpawnEntity(Position, Texture, Scale, 1.0F) 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.MoveEntity(Nothing, True, Destination.X, Destination.Y, Destination.Z, 0.05F, False, True, CSng(startDelay), 0.0F) Threading.Interlocked.Increment(currentAmount) End While - MoveAnimation.AnimationPlaySound("Battle\Effects\Stat_Lower", 0.0F, 10.0F) - BattleScreen.BattleQuery.Add(MoveAnimation) + StatAnimation.PlaySound("Battle\Effects\Stat_Lower", 0.0F, 10.0F) + BattleScreen.BattleQuery.Add(StatAnimation) Dim printMessage As String = p.GetDisplayName() & "'s " & statString Select Case val @@ -4005,10 +3998,10 @@ End If 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) + HitAnimation.FadeEntity(Nothing, False, 1, False, 0, 0, 0) + HitAnimation.FadeEntity(Nothing, False, 1, True, 1, 1, 0) + HitAnimation.FadeEntity(Nothing, False, 1, False, 0, 2, 0) + HitAnimation.FadeEntity(Nothing, False, 1, True, 1, 3, 0) BattleScreen.BattleQuery.Add(HitAnimation) If own = True Then @@ -4763,14 +4756,14 @@ #End Region - ''' - ''' Switches camera to angle - ''' - ''' 0=main battle/1=own pokemon/2=opp pokemon - ''' If the code comes from the own player or not. - ''' Battlescreen reference - ''' If the call should get added the PVP list or the own queue. - Public Sub ChangeCameraAngle(ByVal direction As Integer, ByVal own As Boolean, ByVal BattleScreen As BattleScreen, Optional ByVal AddPVP As Boolean = False) + ''' + ''' Switches camera to angle + ''' + ''' 0=main battle/1=own pokemon/2=opp pokemon + ''' If the code comes from the own player or not. + ''' Battlescreen reference + ''' If the call should get added the PVP list or the own queue. + Public Sub ChangeCameraAngle(ByVal direction As Integer, ByVal own As Boolean, ByVal BattleScreen As BattleScreen, Optional ByVal AddPVP As Boolean = False) Dim q As CameraQueryObject = Nothing Select Case direction @@ -5364,7 +5357,7 @@ If .OwnPokemon.Status = Pokemon.StatusProblems.Poison Then 'Own Poison 'Poison animation Dim PoisonAnimation As AnimationQueryObject = New AnimationQueryObject(BattleScreen.OwnPokemonNPC, True) - PoisonAnimation.AnimationPlaySound("Battle\Effects\Poisoned", 0, 0) + PoisonAnimation.PlaySound("Battle\Effects\Poisoned", 0, 0) PoisonAnimation.AnimationSpawnFadingEntity(-0.25, -0.25, -0.25, "Textures\Battle\Poison\Bubble,0,0,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 0, 1) PoisonAnimation.AnimationSpawnFadingEntity(-0.25, -0.25, -0.25, "Textures\Battle\Poison\Bubble,0,32,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 1, 1) @@ -5388,7 +5381,7 @@ Dim multiplier As Double = (.FieldEffects.OwnPoisonCounter / 16) 'Poison animation Dim PoisonAnimation As AnimationQueryObject = New AnimationQueryObject(BattleScreen.OwnPokemonNPC, True) - PoisonAnimation.AnimationPlaySound("Battle\Effects\Poisoned", 0, 0) + PoisonAnimation.PlaySound("Battle\Effects\Poisoned", 0, 0) PoisonAnimation.AnimationSpawnFadingEntity(-0.25, -0.25, -0.25, "Textures\Battle\Poison\Bubble,0,0,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 0, 1) PoisonAnimation.AnimationSpawnFadingEntity(-0.25, -0.25, -0.25, "Textures\Battle\Poison\Bubble,0,32,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 1, 1) @@ -5420,20 +5413,15 @@ 'Burn animation Dim BurnAnimation As AnimationQueryObject = New AnimationQueryObject(BattleScreen.OwnPokemonNPC, False) - BurnAnimation.AnimationPlaySound("Battle\Effects\Burned", 0, 0) + BurnAnimation.PlaySound("Battle\Effects\Burned", 0, 0) 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) + BurnAnimation.ChangeEntityTexture(FlameEntity, False, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 32, 32, 32)), 2, 1) + BurnAnimation.ChangeEntityTexture(FlameEntity, False, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 64, 32, 32)), 3, 1) + BurnAnimation.ChangeEntityTexture(FlameEntity, False, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 96, 32, 32)), 4, 1) + BurnAnimation.ChangeEntityTexture(FlameEntity, True, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 128, 32, 32)), 5, 2) 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 @@ -6163,7 +6151,7 @@ If .OppPokemon.Status = Pokemon.StatusProblems.Poison Then 'Opp Poison 'Poison animation Dim PoisonAnimation As AnimationQueryObject = New AnimationQueryObject(BattleScreen.OppPokemonNPC, False) - PoisonAnimation.AnimationPlaySound("Battle\Effects\Poisoned", 0, 0) + PoisonAnimation.PlaySound("Battle\Effects\Poisoned", 0, 0) PoisonAnimation.AnimationSpawnFadingEntity(-0.25, -0.25, -0.25, "Textures\Battle\Poison\Bubble,0,0,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 0, 1) PoisonAnimation.AnimationSpawnFadingEntity(-0.25, -0.25, -0.25, "Textures\Battle\Poison\Bubble,0,32,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 1, 1) @@ -6187,7 +6175,7 @@ Dim multiplier As Double = (.FieldEffects.OppPoisonCounter / 16) 'Poison animation Dim PoisonAnimation As AnimationQueryObject = New AnimationQueryObject(BattleScreen.OppPokemonNPC, False) - PoisonAnimation.AnimationPlaySound("Battle\Effects\Poisoned", 0, 0) + PoisonAnimation.PlaySound("Battle\Effects\Poisoned", 0, 0) PoisonAnimation.AnimationSpawnFadingEntity(-0.25, -0.25, -0.25, "Textures\Battle\Poison\Bubble,0,0,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 0, 1) PoisonAnimation.AnimationSpawnFadingEntity(-0.25, -0.25, -0.25, "Textures\Battle\Poison\Bubble,0,32,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 1, 1) @@ -6218,20 +6206,15 @@ End If 'Burn animation Dim BurnAnimation As AnimationQueryObject = New AnimationQueryObject(BattleScreen.OppPokemonNPC, False) - BurnAnimation.AnimationPlaySound("Battle\Effects\Burned", 0, 0) + BurnAnimation.PlaySound("Battle\Effects\Burned", 0, 0) 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) + BurnAnimation.ChangeEntityTexture(FlameEntity, False, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 32, 32, 32)), 2, 1) + BurnAnimation.ChangeEntityTexture(FlameEntity, False, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 64, 32, 32)), 3, 1) + BurnAnimation.ChangeEntityTexture(FlameEntity, False, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 96, 32, 32)), 4, 1) + BurnAnimation.ChangeEntityTexture(FlameEntity, True, TextureManager.GetTexture("Textures\Battle\Fire\Ember", New Rectangle(0, 128, 32, 32)), 5, 2) 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 @@ -6756,38 +6739,38 @@ End If Else If BattleScreen.IsTrainerBattle = True Then - EndBattle(EndBattleReasons.LoseTrainer, BattleScreen, False) - If BattleScreen.IsRemoteBattle = True Then - EndBattle(EndBattleReasons.LoseTrainer, BattleScreen, True) - End If - Else - EndBattle(EndBattleReasons.LoseWild, BattleScreen, False) - End If - End If - End With - End Sub + EndBattle(EndBattleReasons.LoseTrainer, BattleScreen, False) + If BattleScreen.IsRemoteBattle = True Then + EndBattle(EndBattleReasons.LoseTrainer, BattleScreen, True) + End If + Else + EndBattle(EndBattleReasons.LoseWild, BattleScreen, False) + End If + End If + End With + End Sub - Public Sub ApplyOwnBatonPass(ByVal BattleScreen As BattleScreen) - If BattleScreen.FieldEffects.OwnUsedBatonPass = True Then - BattleScreen.FieldEffects.OwnUsedBatonPass = False + Public Sub ApplyOwnBatonPass(ByVal BattleScreen As BattleScreen) + If BattleScreen.FieldEffects.OwnUsedBatonPass = True Then + BattleScreen.FieldEffects.OwnUsedBatonPass = False - BattleScreen.OwnPokemon.StatAttack = BattleScreen.FieldEffects.OwnBatonPassStats(0) - BattleScreen.OwnPokemon.StatDefense = BattleScreen.FieldEffects.OwnBatonPassStats(1) - BattleScreen.OwnPokemon.StatSpAttack = BattleScreen.FieldEffects.OwnBatonPassStats(2) - BattleScreen.OwnPokemon.StatSpDefense = BattleScreen.FieldEffects.OwnBatonPassStats(3) - BattleScreen.OwnPokemon.StatSpeed = BattleScreen.FieldEffects.OwnBatonPassStats(4) - BattleScreen.OwnPokemon.Evasion = BattleScreen.FieldEffects.OwnBatonPassStats(5) - BattleScreen.OwnPokemon.Accuracy = BattleScreen.FieldEffects.OwnBatonPassStats(6) + BattleScreen.OwnPokemon.StatAttack = BattleScreen.FieldEffects.OwnBatonPassStats(0) + BattleScreen.OwnPokemon.StatDefense = BattleScreen.FieldEffects.OwnBatonPassStats(1) + BattleScreen.OwnPokemon.StatSpAttack = BattleScreen.FieldEffects.OwnBatonPassStats(2) + BattleScreen.OwnPokemon.StatSpDefense = BattleScreen.FieldEffects.OwnBatonPassStats(3) + BattleScreen.OwnPokemon.StatSpeed = BattleScreen.FieldEffects.OwnBatonPassStats(4) + BattleScreen.OwnPokemon.Evasion = BattleScreen.FieldEffects.OwnBatonPassStats(5) + BattleScreen.OwnPokemon.Accuracy = BattleScreen.FieldEffects.OwnBatonPassStats(6) - If BattleScreen.FieldEffects.OwnBatonPassConfusion = True Then - BattleScreen.FieldEffects.OwnBatonPassConfusion = False - BattleScreen.OwnPokemon.AddVolatileStatus(Pokemon.VolatileStatus.Confusion) - End If - End If - End Sub + If BattleScreen.FieldEffects.OwnBatonPassConfusion = True Then + BattleScreen.FieldEffects.OwnBatonPassConfusion = False + BattleScreen.OwnPokemon.AddVolatileStatus(Pokemon.VolatileStatus.Confusion) + End If + End If + End Sub - Public Sub SwitchInOwn(ByVal BattleScreen As BattleScreen, ByVal NewPokemonIndex As Integer, ByVal FirstTime As Boolean, ByVal InsertIndex As Integer, Optional ByVal message As String = "") - HasSwitchedInOwn = True + Public Sub SwitchInOwn(ByVal BattleScreen As BattleScreen, ByVal NewPokemonIndex As Integer, ByVal FirstTime As Boolean, ByVal InsertIndex As Integer, Optional ByVal message As String = "") + HasSwitchedInOwn = True If FirstTime = False Then Dim insertMessage As String = message @@ -6800,28 +6783,32 @@ Dim BallReturn As AnimationQueryObject = New AnimationQueryObject(BattleScreen.OwnPokemonNPC, False, BattleScreen.OwnPokemonModel) ' Ball Closes - BallReturn.AnimationPlaySound("Battle\Pokeball\Open", 0, 0) + BallReturn.PlaySound("Battle\Pokeball\Open", 0, 0) 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 SmokeDestination As Vector3 = New Vector3(0, 0, 0) - Dim SmokeTexture As String = "Textures\Battle\Cloud" + Dim SmokeTexture As Texture2D = TextureManager.GetTexture("Textures\Battle\Smoke") Dim SmokeScale = New Vector3(CSng(Random.Next(2, 6) / 10)) Dim SmokeSpeed = CSng(Random.Next(1, 3) / 10.0F) - BallReturn.AnimationSpawnMovingEntity(SmokePosition.X, SmokePosition.Y, SmokePosition.Z, SmokeTexture, SmokeScale.X, SmokeScale.Y, SmokeScale.Z, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 0.0F, 0.0F) + Dim SmokeEntity As Entity = BallReturn.SpawnEntity(SmokePosition, SmokeTexture, SmokeScale, 1.0F) + + BallReturn.MoveEntity(SmokeEntity, True, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 0.0F, 0.0F) + Threading.Interlocked.Increment(SmokeReturned) Loop While SmokeReturned <= 38 ' Pokemon disappears - BallReturn.AnimationFadeEntity(Nothing, 1, False, 0, 1, 0) - BallReturn.AnimationMoveEntity(Nothing, 0, 0.5, 0, 0.5, False, False, 2, 0,,, 3) + BallReturn.FadeEntity(Nothing, False, 1, False, 0, 1, 0) + BallReturn.MoveEntity(Nothing, False, 0, 0.5, 0, 0.5, False, False, 2, 0,,, 3) ' Ball returns - BallReturn.AnimationPlaySound("Battle\Pokeball\Throw", 1, 0) - BallReturn.AnimationSpawnMovingEntity(0, 0, 0, BattleScreen.OwnPokemon.CatchBall.TextureSource, 0.3F, 0.3F, 0.3F, -2, 0, 0, 0.1, False, True, 1, 0,, 0.3) + BallReturn.PlaySound("Battle\Pokeball\Throw", 1, 0) + Dim BallReturnEntity As Entity = BallReturn.SpawnEntity(BattleScreen.OwnPokemonNPC.Position, TextureManager.GetTexture(BattleScreen.OwnPokemon.CatchBall.TextureSource), New Vector3(0.3F), 1.0F) + BallReturn.MoveEntity(BallReturnEntity, True, BattleScreen.OwnPokemonNPC.Position.X - 2, BattleScreen.OwnPokemonNPC.Position.Y, BattleScreen.OwnPokemonNPC.Position.Z, 0.1, False, True, 1, 0,, 0.3) BattleScreen.AddToQuery(InsertIndex, BallReturn) @@ -6859,315 +6846,322 @@ ' Ball is thrown Dim BallThrow As AnimationQueryObject = New AnimationQueryObject(BattleScreen.OwnPokemonNPC, False, BattleScreen.OwnPokemonModel) - BallThrow.AnimationPlaySound("Battle\Pokeball\Throw", 0, 0) - BallThrow.AnimationSpawnMovingEntity(-2, -0.15, 0, BattleScreen.OwnPokemon.CatchBall.TextureSource, 0.3F, 0.3F, 0.3F, 0, 0.35, 0, 0.1, False, True, 0F, 0F,, 0.3) + + BallThrow.PlaySound("Battle\Pokeball\Throw", 0, 0) + + Dim BallThrowEntity As Entity = BallReturn.SpawnEntity(BattleScreen.OwnPokemonNPC.Position + New Vector3(-2, -0.15, 0), TextureManager.GetTexture(BattleScreen.OwnPokemon.CatchBall.TextureSource), New Vector3(0.3F), 1.0F) + BallThrow.MoveEntity(BallThrowEntity, True, BattleScreen.OwnPokemonNPC.Position.X, CSng(BattleScreen.OwnPokemonNPC.Position.Y + 0.35), BattleScreen.OwnPokemonNPC.Position.Z, 0.1, False, True, 0F, 0F,, 0.3) ' Ball Opens - BallThrow.AnimationPlaySound("Battle\Pokeball\Open", 3, 0) + BallThrow.PlaySound("Battle\Pokeball\Open", 3, 0) + Dim SmokeSpawned As Integer = 0 Do Dim SmokePosition = New Vector3(0, 0.35, 0) Dim SmokeDestination = New Vector3(CSng(Random.Next(-10, 10) / 10), CSng(Random.Next(-10, 10) / 10), CSng(Random.Next(-10, 10) / 10)) - Dim SmokeTexture As String = "Textures\Battle\Cloud" + Dim SmokeTexture As Texture2D = TextureManager.GetTexture("Textures\Battle\Smoke") Dim SmokeScale = New Vector3(CSng(Random.Next(2, 6) / 10)) Dim SmokeSpeed = CSng(Random.Next(1, 3) / 10.0F) - BallThrow.AnimationSpawnMovingEntity(SmokePosition.X, SmokePosition.Y, SmokePosition.Z, SmokeTexture, SmokeScale.X, SmokeScale.Y, SmokeScale.Z, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 3.0F, 0.0F) + Dim SmokeEntity As Entity = BallThrow.SpawnEntity(SmokePosition, SmokeTexture, SmokeScale, 1.0F) + + BallThrow.MoveEntity(SmokeEntity, True, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 3.0F, 0.0F) + Threading.Interlocked.Increment(SmokeSpawned) Loop While SmokeSpawned <= 38 ' Pokemon appears - BallThrow.AnimationFadeEntity(Nothing, 1, True, 1, 4, 0) - BallThrow.AnimationPlaySound(CStr(BattleScreen.OwnPokemon.Number), 4, 0,, True) + BallThrow.FadeEntity(Nothing, False, 1, True, 1, 4, 0) + BallThrow.PlaySound(CStr(BattleScreen.OwnPokemon.Number), 4, 0,, True) ' Pokémon falls down - BallThrow.AnimationMoveEntity(Nothing, 0, 0, 0, 0.05F, False, False, 4, 0,,, 3) + BallThrow.MoveEntity(Nothing, False, 0, 0, 0, 0.05F, False, False, 4, 0,,, 3) BattleScreen.AddToQuery(InsertIndex, BallThrow) End If With BattleScreen - If .FieldEffects.UsedPokemon.Contains(NewPokemonIndex) = False Then - .FieldEffects.UsedPokemon.Add(NewPokemonIndex) - End If + If .FieldEffects.UsedPokemon.Contains(NewPokemonIndex) = False Then + .FieldEffects.UsedPokemon.Add(NewPokemonIndex) + End If - If Not .OwnPokemon.Item Is Nothing Then - If .OwnPokemon.Item.Name.ToLower() = "amulet coin" Or .OwnPokemon.Item.Name.ToLower() = "luck incense" Then - If .FieldEffects.CanUseItem(True) = True And .FieldEffects.CanUseOwnItem(True, BattleScreen) = True Then - BattleScreen.FieldEffects.AmuletCoin += 1 - End If - End If - End If + If Not .OwnPokemon.Item Is Nothing Then + If .OwnPokemon.Item.Name.ToLower() = "amulet coin" Or .OwnPokemon.Item.Name.ToLower() = "luck incense" Then + If .FieldEffects.CanUseItem(True) = True And .FieldEffects.CanUseOwnItem(True, BattleScreen) = True Then + BattleScreen.FieldEffects.AmuletCoin += 1 + End If + End If + End If - Dim p As Pokemon = .OwnPokemon - Dim op As Pokemon = .OppPokemon + Dim p As Pokemon = .OwnPokemon + Dim op As Pokemon = .OppPokemon - Dim spikeAffected As Boolean = True - Dim rockAffected As Boolean = True + Dim spikeAffected As Boolean = True + Dim rockAffected As Boolean = True - spikeAffected = BattleScreen.FieldEffects.IsGrounded(True, BattleScreen) + spikeAffected = BattleScreen.FieldEffects.IsGrounded(True, BattleScreen) - 'Spikes - If spikeAffected = True Then - If .FieldEffects.OppSpikes > 0 And (p.Ability.Name.ToLower() <> "magic guard" Or BattleScreen.FieldEffects.CanUseAbility(True, BattleScreen, 1) = False) Then - Dim spikeDamage As Double = 1D - Select Case .FieldEffects.OppSpikes - Case 1 - spikeDamage = (p.MaxHP / 100) * 12.5D - Case 2 - spikeDamage = (p.MaxHP / 100) * 16.7D - Case 3 - spikeDamage = (p.MaxHP / 100) * 25D - End Select - ReduceHP(CInt(spikeDamage), True, False, BattleScreen, "The Spikes hurt " & p.GetDisplayName() & "!", "spikes") - End If - End If + 'Spikes + If spikeAffected = True Then + If .FieldEffects.OppSpikes > 0 And (p.Ability.Name.ToLower() <> "magic guard" Or BattleScreen.FieldEffects.CanUseAbility(True, BattleScreen, 1) = False) Then + Dim spikeDamage As Double = 1D + Select Case .FieldEffects.OppSpikes + Case 1 + spikeDamage = (p.MaxHP / 100) * 12.5D + Case 2 + spikeDamage = (p.MaxHP / 100) * 16.7D + Case 3 + spikeDamage = (p.MaxHP / 100) * 25D + End Select + ReduceHP(CInt(spikeDamage), True, False, BattleScreen, "The Spikes hurt " & p.GetDisplayName() & "!", "spikes") + End If + End If - 'Sticky Web - If spikeAffected = True Then - If .FieldEffects.OppStickyWeb > 0 Then + 'Sticky Web + If spikeAffected = True Then + If .FieldEffects.OppStickyWeb > 0 Then - LowerStat(True, True, BattleScreen, "Speed", 1, "Your pokemon was caught in a Sticky Web!", "stickyweb") + LowerStat(True, True, BattleScreen, "Speed", 1, "Your pokemon was caught in a Sticky Web!", "stickyweb") - End If - End If + End If + End If - 'Toxic Spikes - If spikeAffected = True Then - If .FieldEffects.OppToxicSpikes > 0 And p.Status = Pokemon.StatusProblems.None And p.Type1.Type <> Element.Types.Poison And p.Type2.Type <> Element.Types.Poison Then - Select Case .FieldEffects.OppToxicSpikes - Case 1 - InflictPoison(True, False, BattleScreen, False, "The Toxic Spikes hurt " & p.GetDisplayName() & "!", "toxicspikes") - Case 2 - InflictPoison(True, False, BattleScreen, True, "The Toxic Spikes hurt " & p.GetDisplayName() & "!", "toxicspikes") - End Select - End If - If .FieldEffects.OppToxicSpikes > 0 Then - If p.Type1.Type = Element.Types.Poison Or p.Type2.Type = Element.Types.Poison Then - .AddToQuery(InsertIndex, New TextQueryObject(p.GetDisplayName() & " removed the Toxic Spikes!")) - .FieldEffects.OppToxicSpikes = 0 - End If - End If - End If + 'Toxic Spikes + If spikeAffected = True Then + If .FieldEffects.OppToxicSpikes > 0 And p.Status = Pokemon.StatusProblems.None And p.Type1.Type <> Element.Types.Poison And p.Type2.Type <> Element.Types.Poison Then + Select Case .FieldEffects.OppToxicSpikes + Case 1 + InflictPoison(True, False, BattleScreen, False, "The Toxic Spikes hurt " & p.GetDisplayName() & "!", "toxicspikes") + Case 2 + InflictPoison(True, False, BattleScreen, True, "The Toxic Spikes hurt " & p.GetDisplayName() & "!", "toxicspikes") + End Select + End If + If .FieldEffects.OppToxicSpikes > 0 Then + If p.Type1.Type = Element.Types.Poison Or p.Type2.Type = Element.Types.Poison Then + .AddToQuery(InsertIndex, New TextQueryObject(p.GetDisplayName() & " removed the Toxic Spikes!")) + .FieldEffects.OppToxicSpikes = 0 + End If + End If + End If - 'Stealth Rock - If rockAffected = True Then - If .FieldEffects.OppStealthRock > 0 And (p.Ability.Name.ToLower() <> "magic guard" Or BattleScreen.FieldEffects.CanUseAbility(True, BattleScreen, 1) = False) Then - Dim rocksDamage As Double = 1D + 'Stealth Rock + If rockAffected = True Then + If .FieldEffects.OppStealthRock > 0 And (p.Ability.Name.ToLower() <> "magic guard" Or BattleScreen.FieldEffects.CanUseAbility(True, BattleScreen, 1) = False) Then + Dim rocksDamage As Double = 1D - Dim effectiveness As Single = BattleCalculation.ReverseTypeEffectiveness(Element.GetElementMultiplier(New Element(Element.Types.Rock), p.Type1)) * BattleCalculation.ReverseTypeEffectiveness(Element.GetElementMultiplier(New Element(Element.Types.Rock), p.Type2)) - Select Case effectiveness - Case 0.25F - rocksDamage = (p.MaxHP / 100) * 3.125D - Case 0.5F - rocksDamage = (p.MaxHP / 100) * 6.25D - Case 1.0F - rocksDamage = (p.MaxHP / 100) * 12.5D - Case 2.0F - rocksDamage = (p.MaxHP / 100) * 25D - Case 4.0F - rocksDamage = (p.MaxHP / 100) * 50D - End Select + Dim effectiveness As Single = BattleCalculation.ReverseTypeEffectiveness(Element.GetElementMultiplier(New Element(Element.Types.Rock), p.Type1)) * BattleCalculation.ReverseTypeEffectiveness(Element.GetElementMultiplier(New Element(Element.Types.Rock), p.Type2)) + Select Case effectiveness + Case 0.25F + rocksDamage = (p.MaxHP / 100) * 3.125D + Case 0.5F + rocksDamage = (p.MaxHP / 100) * 6.25D + Case 1.0F + rocksDamage = (p.MaxHP / 100) * 12.5D + Case 2.0F + rocksDamage = (p.MaxHP / 100) * 25D + Case 4.0F + rocksDamage = (p.MaxHP / 100) * 50D + End Select - ReduceHP(CInt(rocksDamage), True, False, BattleScreen, "The Stealth Rocks hurt " & p.GetDisplayName() & "!", "stealthrocks") - End If - End If + ReduceHP(CInt(rocksDamage), True, False, BattleScreen, "The Stealth Rocks hurt " & p.GetDisplayName() & "!", "stealthrocks") + End If + End If - TriggerAbilityEffect(BattleScreen, True) - TriggerItemEffect(BattleScreen, True) + TriggerAbilityEffect(BattleScreen, True) + TriggerItemEffect(BattleScreen, True) - If .OwnPokemon.Status = Pokemon.StatusProblems.Sleep Then - .FieldEffects.OwnSleepTurns = Core.Random.Next(1, 4) - End If + If .OwnPokemon.Status = Pokemon.StatusProblems.Sleep Then + .FieldEffects.OwnSleepTurns = Core.Random.Next(1, 4) + End If - If BattleScreen.FieldEffects.OwnHealingWish = True Then - BattleScreen.FieldEffects.OwnHealingWish = False + If BattleScreen.FieldEffects.OwnHealingWish = True Then + BattleScreen.FieldEffects.OwnHealingWish = False - If .OwnPokemon.HP < .OwnPokemon.MaxHP Or .OwnPokemon.Status <> Pokemon.StatusProblems.None Then - GainHP(.OwnPokemon.MaxHP - .OwnPokemon.HP, True, True, BattleScreen, "The Healing Wish came true for " & .OwnPokemon.GetDisplayName() & "!", "move:healingwish") - CureStatusProblem(True, True, BattleScreen, "", "move:healingwish") - End If - End If - End With - End Sub + If .OwnPokemon.HP < .OwnPokemon.MaxHP Or .OwnPokemon.Status <> Pokemon.StatusProblems.None Then + GainHP(.OwnPokemon.MaxHP - .OwnPokemon.HP, True, True, BattleScreen, "The Healing Wish came true for " & .OwnPokemon.GetDisplayName() & "!", "move:healingwish") + CureStatusProblem(True, True, BattleScreen, "", "move:healingwish") + End If + End If + End With + End Sub - Public Sub SwitchOutOpp(ByVal BattleScreen As BattleScreen, ByVal index As Integer, Optional ByVal message As String = "") - With BattleScreen - 'Natural cure cures status problems - If .OppPokemon.Ability.Name.ToLower() = "natural cure" Then - If .OppPokemon.Status <> Pokemon.StatusProblems.Fainted And .OppPokemon.Status <> Pokemon.StatusProblems.None Then - .OppPokemon.Status = Pokemon.StatusProblems.None - .BattleQuery.Add(New TextQueryObject(.OppPokemon.GetDisplayName() & "'s status problem got healed by Natural Cure")) - End If - End If - 'Regenerator ability heals 1/3 of it's max HP - If .OppPokemon.Ability.Name.ToLower() = "regenerator" Then - If Not (.OppPokemon.Status = Pokemon.StatusProblems.Fainted Or .OppPokemon.HP = 0) Then - Dim restoreHP = CInt(.OppPokemon.MaxHP / 3) - If restoreHP > 0 And .OppPokemon.HP < .OppPokemon.MaxHP And .OppPokemon.HP > 0 Then - BattleScreen.Battle.GainHP(restoreHP, False, True, BattleScreen, .OppPokemon.GetDisplayName() & "'s HP was restored!", "ability:regenerator") - End If - End If - End If - 'save baton pass stuff: - If .FieldEffects.OppUsedBatonPass = True Then - .FieldEffects.OppBatonPassStats = New List(Of Integer) - With .OppPokemon - BattleScreen.FieldEffects.OppBatonPassStats.AddRange({ .StatAttack, .StatDefense, .StatSpAttack, .StatSpDefense, .StatSpeed, .Evasion, .Accuracy}) - End With - .FieldEffects.OppBatonPassConfusion = .OppPokemon.HasVolatileStatus(Pokemon.VolatileStatus.Confusion) = True - End If + Public Sub SwitchOutOpp(ByVal BattleScreen As BattleScreen, ByVal index As Integer, Optional ByVal message As String = "") + With BattleScreen + 'Natural cure cures status problems + If .OppPokemon.Ability.Name.ToLower() = "natural cure" Then + If .OppPokemon.Status <> Pokemon.StatusProblems.Fainted And .OppPokemon.Status <> Pokemon.StatusProblems.None Then + .OppPokemon.Status = Pokemon.StatusProblems.None + .BattleQuery.Add(New TextQueryObject(.OppPokemon.GetDisplayName() & "'s status problem got healed by Natural Cure")) + End If + End If + 'Regenerator ability heals 1/3 of it's max HP + If .OppPokemon.Ability.Name.ToLower() = "regenerator" Then + If Not (.OppPokemon.Status = Pokemon.StatusProblems.Fainted Or .OppPokemon.HP = 0) Then + Dim restoreHP = CInt(.OppPokemon.MaxHP / 3) + If restoreHP > 0 And .OppPokemon.HP < .OppPokemon.MaxHP And .OppPokemon.HP > 0 Then + BattleScreen.Battle.GainHP(restoreHP, False, True, BattleScreen, .OppPokemon.GetDisplayName() & "'s HP was restored!", "ability:regenerator") + End If + End If + End If + 'save baton pass stuff: + If .FieldEffects.OppUsedBatonPass = True Then + .FieldEffects.OppBatonPassStats = New List(Of Integer) + With .OppPokemon + BattleScreen.FieldEffects.OppBatonPassStats.AddRange({ .StatAttack, .StatDefense, .StatSpAttack, .StatSpDefense, .StatSpeed, .Evasion, .Accuracy}) + End With + .FieldEffects.OppBatonPassConfusion = .OppPokemon.HasVolatileStatus(Pokemon.VolatileStatus.Confusion) = True + End If - 'Set the original objects of Pokemon - .OppPokemon.ResetTemp() + 'Set the original objects of Pokemon + .OppPokemon.ResetTemp() - 'Remove volatiles - .OppPokemon.ClearAllVolatiles() + 'Remove volatiles + .OppPokemon.ClearAllVolatiles() - 'Resetting FieldEffects - With .FieldEffects - .OppSleepTurns = 0 - .OppTruantRound = 0 - .OppTaunt = 0 - .OppSmacked = 0 - .OppRageCounter = 0 - .OppUproar = 0 - If .OppUsedBatonPass = False Then .OppFocusEnergy = 0 - .OppEndure = 0 - .OppProtectCounter = 0 - .OppDetectCounter = 0 - .OppKingsShieldCounter = 0 - .OppProtectMovesCount = 0 - If .OppUsedBatonPass = False Then .OppIngrain = 0 - If .OppUsedBatonPass = False Then .OppSubstitute = 0 - If .OppUsedBatonPass = False Then .OppMagnetRise = 0 - If .OppUsedBatonPass = False Then .OppAquaRing = 0 - .OppPoisonCounter = 0 - .OppNightmare = 0 - If .OppUsedBatonPass = False Then .OppCurse = 0 - .OppOutrage = 0 - .OppThrash = 0 - .OppPetalDance = 0 - .OppEncore = 0 - .OppEncoreMove = Nothing - If .OppUsedBatonPass = False Then .OppEmbargo = 0 - .OppYawn = 0 - If .OppUsedBatonPass = False Then .OppPerishSongCount = 0 - .OppConfusionTurns = 0 - .OppTorment = 0 - .OppTormentMove = Nothing - .OppChoiceMove = Nothing - .OppRecharge = 0 - .OppRolloutCounter = 0 - .OppIceBallCounter = 0 - .OppDefenseCurl = 0 - .OppCharge = 0 - .OppSolarBeam = 0 - .OppSolarBlade = 0 - If .OppUsedBatonPass = False Then .OppLeechSeed = 0 - If .OppUsedBatonPass = False Then .OppLockOn = 0 - .OppLansatBerry = 0 - .OppCustapBerry = 0 - .OppTrappedCounter = 0 - .OppFuryCutter = 0 - .OppEchoedVoice = 0 - .OppPokemonTurns = 0 - .OppStockpileCount = 0 - .OppDestinyBond = False - .OppGastroAcid = False + 'Resetting FieldEffects + With .FieldEffects + .OppSleepTurns = 0 + .OppTruantRound = 0 + .OppTaunt = 0 + .OppSmacked = 0 + .OppRageCounter = 0 + .OppUproar = 0 + If .OppUsedBatonPass = False Then .OppFocusEnergy = 0 + .OppEndure = 0 + .OppProtectCounter = 0 + .OppDetectCounter = 0 + .OppKingsShieldCounter = 0 + .OppProtectMovesCount = 0 + If .OppUsedBatonPass = False Then .OppIngrain = 0 + If .OppUsedBatonPass = False Then .OppSubstitute = 0 + If .OppUsedBatonPass = False Then .OppMagnetRise = 0 + If .OppUsedBatonPass = False Then .OppAquaRing = 0 + .OppPoisonCounter = 0 + .OppNightmare = 0 + If .OppUsedBatonPass = False Then .OppCurse = 0 + .OppOutrage = 0 + .OppThrash = 0 + .OppPetalDance = 0 + .OppEncore = 0 + .OppEncoreMove = Nothing + If .OppUsedBatonPass = False Then .OppEmbargo = 0 + .OppYawn = 0 + If .OppUsedBatonPass = False Then .OppPerishSongCount = 0 + .OppConfusionTurns = 0 + .OppTorment = 0 + .OppTormentMove = Nothing + .OppChoiceMove = Nothing + .OppRecharge = 0 + .OppRolloutCounter = 0 + .OppIceBallCounter = 0 + .OppDefenseCurl = 0 + .OppCharge = 0 + .OppSolarBeam = 0 + .OppSolarBlade = 0 + If .OppUsedBatonPass = False Then .OppLeechSeed = 0 + If .OppUsedBatonPass = False Then .OppLockOn = 0 + .OppLansatBerry = 0 + .OppCustapBerry = 0 + .OppTrappedCounter = 0 + .OppFuryCutter = 0 + .OppEchoedVoice = 0 + .OppPokemonTurns = 0 + .OppStockpileCount = 0 + .OppDestinyBond = False + .OppGastroAcid = False - .OppFlyCounter = 0 - .OppDigCounter = 0 - .OppBounceCounter = 0 - .OppDiveCounter = 0 - .OppShadowForceCounter = 0 - .OppPhantomForceCounter = 0 - .OppSkyDropCounter = 0 - .OppGeomancyCounter = 0 - .OppSkyAttackCounter = 0 - .OppRazorWindCounter = 0 - .OppSkullBashCounter = 0 + .OppFlyCounter = 0 + .OppDigCounter = 0 + .OppBounceCounter = 0 + .OppDiveCounter = 0 + .OppShadowForceCounter = 0 + .OppPhantomForceCounter = 0 + .OppSkyDropCounter = 0 + .OppGeomancyCounter = 0 + .OppSkyAttackCounter = 0 + .OppRazorWindCounter = 0 + .OppSkullBashCounter = 0 - .OppForesight = 0 - .OppOdorSleuth = 0 - .OppMiracleEye = 0 + .OppForesight = 0 + .OppOdorSleuth = 0 + .OppMiracleEye = 0 - .OppWrap = 0 - .OppWhirlpool = 0 - .OppBind = 0 - .OppClamp = 0 - .OppFireSpin = 0 - .OppMagmaStorm = 0 - .OppSandTomb = 0 - .OppInfestation = 0 + .OppWrap = 0 + .OppWhirlpool = 0 + .OppBind = 0 + .OppClamp = 0 + .OppFireSpin = 0 + .OppMagmaStorm = 0 + .OppSandTomb = 0 + .OppInfestation = 0 - .OppBideCounter = 0 - .OppBideDamage = 0 + .OppBideCounter = 0 + .OppBideDamage = 0 - .OppRoostUsed = False + .OppRoostUsed = False - 'Own stuff that depends on opp pokemon presence - .OwnTrappedCounter = 0 - .OwnWrap = 0 - .OwnWhirlpool = 0 - .OwnBind = 0 - .OwnClamp = 0 - .OwnFireSpin = 0 - .OwnMagmaStorm = 0 - .OwnSandTomb = 0 - .OwnInfestation = 0 + 'Own stuff that depends on opp pokemon presence + .OwnTrappedCounter = 0 + .OwnWrap = 0 + .OwnWhirlpool = 0 + .OwnBind = 0 + .OwnClamp = 0 + .OwnFireSpin = 0 + .OwnMagmaStorm = 0 + .OwnSandTomb = 0 + .OwnInfestation = 0 - If BattleScreen.OwnPokemon.HasVolatileStatus(Pokemon.VolatileStatus.Infatuation) Then - BattleScreen.OwnPokemon.RemoveVolatileStatus(Pokemon.VolatileStatus.Infatuation) - End If - End With - End With + If BattleScreen.OwnPokemon.HasVolatileStatus(Pokemon.VolatileStatus.Infatuation) Then + BattleScreen.OwnPokemon.RemoveVolatileStatus(Pokemon.VolatileStatus.Infatuation) + End If + End With + End With - BattleScreen.OppPokemon.Ability.SwitchOut(BattleScreen.OppPokemon) + BattleScreen.OppPokemon.Ability.SwitchOut(BattleScreen.OppPokemon) - If BattleScreen.IsTrainerBattle = False Then + If BattleScreen.IsTrainerBattle = False Then 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.AnimationMoveEntity(Nothing, 0, -1, 0, 0.1, False, False, 2, 0,,, 3) + Faint.PlaySound(CStr(BattleScreen.OppPokemon.Number), 0, 2, False, True) + Faint.MoveEntity(Nothing, False, 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)) - EndBattle(EndBattleReasons.WinWild, BattleScreen, False) - Else - If BattleScreen.TrainerHasFightablePokemon() = True Then - If BattleScreen.OppPokemon.HP <= 0 Or BattleScreen.OppPokemon.Status = Pokemon.StatusProblems.Fainted Then - GainEXP(BattleScreen) - End If + EndBattle(EndBattleReasons.WinWild, BattleScreen, False) + Else + If BattleScreen.TrainerHasFightablePokemon() = True Then + If BattleScreen.OppPokemon.HP <= 0 Or BattleScreen.OppPokemon.Status = Pokemon.StatusProblems.Fainted Then + GainEXP(BattleScreen) + End If If BattleScreen.IsRemoteBattle And BattleScreen.OppFaint Then - 'Next pokemon is selected by the opponent. - Else - SwitchInOpp(BattleScreen, False, index) - End If - Else - GainEXP(BattleScreen) + 'Next pokemon is selected by the opponent. + Else + SwitchInOpp(BattleScreen, False, index) + End If + Else + GainEXP(BattleScreen) If message = "" Then - message = BattleScreen.Trainer.Name & ": ""Come back, " & BattleScreen.OppPokemon.GetDisplayName() & "!""" - End If + message = BattleScreen.Trainer.Name & ": ""Come back, " & BattleScreen.OppPokemon.GetDisplayName() & "!""" + End If - BattleScreen.BattleQuery.Add(New TextQueryObject(message)) + BattleScreen.BattleQuery.Add(New TextQueryObject(message)) Dim BallReturn As AnimationQueryObject = New AnimationQueryObject(BattleScreen.OppPokemonNPC, True, BattleScreen.OppPokemonModel) ' Ball Closes - BallReturn.AnimationPlaySound("Battle\Pokeball\Open", 0, 0) + BallReturn.PlaySound("Battle\Pokeball\Open", 0, 0) 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 SmokeTexture As String = "Textures\Battle\Cloud" + Dim SmokeTexture As String = "Textures\Battle\Smoke" Dim SmokeScale = New Vector3(CSng(Random.Next(2, 6) / 10)) Dim SmokeSpeed = CSng(Random.Next(1, 3) / 10.0F) @@ -7178,57 +7172,57 @@ ' Pokemon disappears BallReturn.AnimationFadeEntity(Nothing, 1, False, 0, 1, 0) - BallReturn.AnimationMoveEntity(Nothing, 0, 0.5, 0, 0.5, False, False, 2, 0,,, 4) + BallReturn.MoveEntity(Nothing, False, 0, 0.5, 0, 0.5, False, False, 2, 0,,, 4) ' Ball returns - BallReturn.AnimationPlaySound("Battle\Pokeball\Throw", 1, 0) + BallReturn.PlaySound("Battle\Pokeball\Throw", 1, 0) BallReturn.AnimationSpawnMovingEntity(0, 0, 0, BattleScreen.OppPokemon.CatchBall.TextureSource, 0.3F, 0.3F, 0.3F, -2, 0, 0, 0.1, False, True, 1, 0,, 0.3) BattleScreen.BattleQuery.Add(BallReturn) EndBattle(EndBattleReasons.WinTrainer, BattleScreen, False) - If BattleScreen.IsRemoteBattle = True Then - EndBattle(EndBattleReasons.WinTrainer, BattleScreen, True) - End If - End If - End If - End Sub + If BattleScreen.IsRemoteBattle = True Then + EndBattle(EndBattleReasons.WinTrainer, BattleScreen, True) + End If + End If + End If + End Sub - Public Sub ApplyOppBatonPass(ByVal BattleScreen As BattleScreen) - If BattleScreen.FieldEffects.OppUsedBatonPass = True Then - BattleScreen.FieldEffects.OppUsedBatonPass = False + Public Sub ApplyOppBatonPass(ByVal BattleScreen As BattleScreen) + If BattleScreen.FieldEffects.OppUsedBatonPass = True Then + BattleScreen.FieldEffects.OppUsedBatonPass = False - BattleScreen.OppPokemon.StatAttack = BattleScreen.FieldEffects.OppBatonPassStats(0) - BattleScreen.OppPokemon.StatDefense = BattleScreen.FieldEffects.OppBatonPassStats(1) - BattleScreen.OppPokemon.StatSpAttack = BattleScreen.FieldEffects.OppBatonPassStats(2) - BattleScreen.OppPokemon.StatSpDefense = BattleScreen.FieldEffects.OppBatonPassStats(3) - BattleScreen.OppPokemon.StatSpeed = BattleScreen.FieldEffects.OppBatonPassStats(4) - BattleScreen.OppPokemon.Evasion = BattleScreen.FieldEffects.OppBatonPassStats(5) - BattleScreen.OppPokemon.Accuracy = BattleScreen.FieldEffects.OppBatonPassStats(6) + BattleScreen.OppPokemon.StatAttack = BattleScreen.FieldEffects.OppBatonPassStats(0) + BattleScreen.OppPokemon.StatDefense = BattleScreen.FieldEffects.OppBatonPassStats(1) + BattleScreen.OppPokemon.StatSpAttack = BattleScreen.FieldEffects.OppBatonPassStats(2) + BattleScreen.OppPokemon.StatSpDefense = BattleScreen.FieldEffects.OppBatonPassStats(3) + BattleScreen.OppPokemon.StatSpeed = BattleScreen.FieldEffects.OppBatonPassStats(4) + BattleScreen.OppPokemon.Evasion = BattleScreen.FieldEffects.OppBatonPassStats(5) + BattleScreen.OppPokemon.Accuracy = BattleScreen.FieldEffects.OppBatonPassStats(6) - If BattleScreen.FieldEffects.OppBatonPassConfusion = True Then - BattleScreen.FieldEffects.OppBatonPassConfusion = False - BattleScreen.OppPokemon.AddVolatileStatus(Pokemon.VolatileStatus.Confusion) - End If - End If - End Sub + If BattleScreen.FieldEffects.OppBatonPassConfusion = True Then + BattleScreen.FieldEffects.OppBatonPassConfusion = False + BattleScreen.OppPokemon.AddVolatileStatus(Pokemon.VolatileStatus.Confusion) + End If + End If + End Sub - Public Sub SwitchInOpp(ByVal BattleScreen As BattleScreen, ByVal FirstTime As Boolean, ByVal index As Integer) + Public Sub SwitchInOpp(ByVal BattleScreen As BattleScreen, ByVal FirstTime As Boolean, ByVal index As Integer) - If FirstTime = False Then - HasSwitchedInOpp = True + If FirstTime = False Then + HasSwitchedInOpp = True BattleScreen.BattleQuery.Add(New TextQueryObject(BattleScreen.Trainer.Name & ": ""Come back, " & BattleScreen.OppPokemon.GetDisplayName() & "!""")) Dim BallReturn As AnimationQueryObject = New AnimationQueryObject(BattleScreen.OppPokemonNPC, True, BattleScreen.OppPokemonModel) ' Ball Closes - BallReturn.AnimationPlaySound("Battle\Pokeball\Open", 0, 0) + BallReturn.PlaySound("Battle\Pokeball\Open", 0, 0) 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 SmokeTexture As String = "Textures\Battle\Cloud" + Dim SmokeTexture As String = "Textures\Battle\Smoke" Dim SmokeScale = New Vector3(CSng(Random.Next(2, 6) / 10)) Dim SmokeSpeed = CSng(Random.Next(1, 3) / 10.0F) @@ -7239,51 +7233,51 @@ ' Pokemon disappears BallReturn.AnimationFadeEntity(Nothing, 1, False, 0, 1, 0) - BallReturn.AnimationMoveEntity(Nothing, 0, 0.5, 0, 0.5, False, False, 2, 0,,, 4) + BallReturn.MoveEntity(Nothing, False, 0, 0.5, 0, 0.5, False, False, 2, 0,,, 4) ' Ball returns - BallReturn.AnimationPlaySound("Battle\Pokeball\Throw", 1, 0) + BallReturn.PlaySound("Battle\Pokeball\Throw", 1, 0) BallReturn.AnimationSpawnMovingEntity(0, 0, 0, BattleScreen.OppPokemon.CatchBall.TextureSource, 0.3F, 0.3F, 0.3F, -2, 0, 0, 0.1, False, True, 1, 0,, 0.3) BattleScreen.BattleQuery.Add(BallReturn) BattleScreen.SendInNewTrainerPokemon(index) - Me.ApplyOppBatonPass(BattleScreen) + Me.ApplyOppBatonPass(BattleScreen) - If BattleScreen.ParticipatedPokemon.Contains(BattleScreen.OwnPokemonIndex) = False Then - BattleScreen.ParticipatedPokemon.Add(BattleScreen.OwnPokemonIndex) - End If + If BattleScreen.ParticipatedPokemon.Contains(BattleScreen.OwnPokemonIndex) = False Then + BattleScreen.ParticipatedPokemon.Add(BattleScreen.OwnPokemonIndex) + End If - Dim oppShiny As String = "N" - If BattleScreen.OppPokemon.IsShiny = True Then - oppShiny = "S" - End If + Dim oppShiny As String = "N" + If BattleScreen.OppPokemon.IsShiny = True Then + oppShiny = "S" + End If - Dim oppModel As String = BattleScreen.GetModelName(False) + Dim oppModel As String = BattleScreen.GetModelName(False) - If oppModel = "" Then - BattleScreen.BattleQuery.Add(New ToggleEntityQueryObject(True, ToggleEntityQueryObject.BattleEntities.OppPokemon, PokemonForms.GetOverworldSpriteName(BattleScreen.OppPokemon), -1, -1, 0, 1)) - Else - BattleScreen.BattleQuery.Add(New ToggleEntityQueryObject(False, oppModel, -1, -1, 1, 0)) - End If + If oppModel = "" Then + BattleScreen.BattleQuery.Add(New ToggleEntityQueryObject(True, ToggleEntityQueryObject.BattleEntities.OppPokemon, PokemonForms.GetOverworldSpriteName(BattleScreen.OppPokemon), -1, -1, 0, 1)) + Else + BattleScreen.BattleQuery.Add(New ToggleEntityQueryObject(False, oppModel, -1, -1, 1, 0)) + End If - BattleScreen.BattleQuery.Add(New ToggleEntityQueryObject(True, ToggleEntityQueryObject.BattleEntities.OppPokemon, 1, -1, -1, -1, -1)) + BattleScreen.BattleQuery.Add(New ToggleEntityQueryObject(True, ToggleEntityQueryObject.BattleEntities.OppPokemon, 1, -1, -1, -1, -1)) BattleScreen.BattleQuery.Add(New TextQueryObject(BattleScreen.Trainer.Name & ": ""Go, " & BattleScreen.OppPokemon.GetDisplayName() & "!""")) ' Ball is thrown Dim BallThrow As AnimationQueryObject = New AnimationQueryObject(BattleScreen.OppPokemonNPC, True, BattleScreen.OppPokemonModel) - BallThrow.AnimationPlaySound("Battle\Pokeball\Throw", 0, 0) + BallThrow.PlaySound("Battle\Pokeball\Throw", 0, 0) BallThrow.AnimationSpawnMovingEntity(-2, -0.15, 0, BattleScreen.OwnPokemon.CatchBall.TextureSource, 0.3F, 0.3F, 0.3F, 0, 0.35, 0, 0.1, False, True, 0F, 0F,, 0.3) ' Ball Opens - BallThrow.AnimationPlaySound("Battle\Pokeball\Open", 3, 0) + BallThrow.PlaySound("Battle\Pokeball\Open", 3, 0) Dim SmokeSpawned As Integer = 0 Do Dim SmokePosition = New Vector3(0, 0.35, 0) Dim SmokeDestination = New Vector3(CSng(Random.Next(-10, 10) / 10), CSng(Random.Next(-10, 10) / 10), CSng(Random.Next(-10, 10) / 10)) - Dim SmokeTexture As String = "Textures\Battle\Cloud" + Dim SmokeTexture As String = "Textures\Battle\Smoke" Dim SmokeScale = New Vector3(CSng(Random.Next(2, 6) / 10)) Dim SmokeSpeed = CSng(Random.Next(1, 3) / 10.0F) @@ -7294,180 +7288,180 @@ ' Pokemon appears BallThrow.AnimationFadeEntity(Nothing, 1, True, 1, 4, 0) - BallThrow.AnimationPlaySound(CStr(BattleScreen.OppPokemon.Number), 4, 0,, True) + BallThrow.PlaySound(CStr(BattleScreen.OppPokemon.Number), 4, 0,, True) ' Pokémon falls down - BallThrow.AnimationMoveEntity(Nothing, 0, 0, 0, 0.05F, False, False, 4, 0,,, 4) + BallThrow.MoveEntity(Nothing, False, 0, 0, 0, 0.05F, False, False, 4, 0,,, 4) BattleScreen.BattleQuery.Add(BallThrow) End If - With BattleScreen - Dim p As Pokemon = .OppPokemon - Dim op As Pokemon = .OwnPokemon + With BattleScreen + Dim p As Pokemon = .OppPokemon + Dim op As Pokemon = .OwnPokemon - Dim spikeAffected As Boolean = True - Dim rockAffected As Boolean = True + Dim spikeAffected As Boolean = True + Dim rockAffected As Boolean = True - spikeAffected = BattleScreen.FieldEffects.IsGrounded(False, BattleScreen) + spikeAffected = BattleScreen.FieldEffects.IsGrounded(False, BattleScreen) - If spikeAffected = True Then - If .FieldEffects.OwnSpikes > 0 And p.Ability.Name.ToLower() <> "magic guard" Then - Dim spikeDamage As Double = 1D - Select Case .FieldEffects.OwnSpikes - Case 1 - spikeDamage = (p.MaxHP / 100) * 12.5D - Case 2 - spikeDamage = (p.MaxHP / 100) * 16.7D - Case 3 - spikeDamage = (p.MaxHP / 100) * 25D - End Select - ReduceHP(CInt(spikeDamage), False, True, BattleScreen, "The Spikes hurt " & p.GetDisplayName() & "!", "spikes") - End If - End If - 'Sticky Web - If spikeAffected = True Then - If .FieldEffects.OwnStickyWeb > 0 Then + If spikeAffected = True Then + If .FieldEffects.OwnSpikes > 0 And p.Ability.Name.ToLower() <> "magic guard" Then + Dim spikeDamage As Double = 1D + Select Case .FieldEffects.OwnSpikes + Case 1 + spikeDamage = (p.MaxHP / 100) * 12.5D + Case 2 + spikeDamage = (p.MaxHP / 100) * 16.7D + Case 3 + spikeDamage = (p.MaxHP / 100) * 25D + End Select + ReduceHP(CInt(spikeDamage), False, True, BattleScreen, "The Spikes hurt " & p.GetDisplayName() & "!", "spikes") + End If + End If + 'Sticky Web + If spikeAffected = True Then + If .FieldEffects.OwnStickyWeb > 0 Then - LowerStat(False, False, BattleScreen, "Speed", 1, "The opposing pokemon was caught in a Sticky Web!", "stickyweb") + LowerStat(False, False, BattleScreen, "Speed", 1, "The opposing pokemon was caught in a Sticky Web!", "stickyweb") - End If - End If - If spikeAffected = True Then - If .FieldEffects.OwnToxicSpikes > 0 And p.Status = Pokemon.StatusProblems.None And p.Type1.Type <> Element.Types.Poison And p.Type2.Type <> Element.Types.Poison Then - Select Case .FieldEffects.OwnToxicSpikes - Case 1 - InflictPoison(False, True, BattleScreen, False, "The Toxic Spikes hurt " & p.GetDisplayName() & "!", "toxicspikes") - Case 2 - InflictPoison(False, True, BattleScreen, True, "The Toxic Spikes hurt " & p.GetDisplayName() & "!", "toxicspikes") - End Select - End If - If .FieldEffects.OwnToxicSpikes > 0 Then - If p.Type1.Type = Element.Types.Poison Or p.Type2.Type = Element.Types.Poison Then - .BattleQuery.Add(New TextQueryObject(p.GetDisplayName() & " removed the Toxic Spikes!")) - .FieldEffects.OwnToxicSpikes = 0 - End If - End If - End If + End If + End If + If spikeAffected = True Then + If .FieldEffects.OwnToxicSpikes > 0 And p.Status = Pokemon.StatusProblems.None And p.Type1.Type <> Element.Types.Poison And p.Type2.Type <> Element.Types.Poison Then + Select Case .FieldEffects.OwnToxicSpikes + Case 1 + InflictPoison(False, True, BattleScreen, False, "The Toxic Spikes hurt " & p.GetDisplayName() & "!", "toxicspikes") + Case 2 + InflictPoison(False, True, BattleScreen, True, "The Toxic Spikes hurt " & p.GetDisplayName() & "!", "toxicspikes") + End Select + End If + If .FieldEffects.OwnToxicSpikes > 0 Then + If p.Type1.Type = Element.Types.Poison Or p.Type2.Type = Element.Types.Poison Then + .BattleQuery.Add(New TextQueryObject(p.GetDisplayName() & " removed the Toxic Spikes!")) + .FieldEffects.OwnToxicSpikes = 0 + End If + End If + End If - If rockAffected = True Then - If .FieldEffects.OwnStealthRock > 0 And p.Ability.Name.ToLower() <> "magic guard" Then - Dim rocksDamage As Double = 1D + If rockAffected = True Then + If .FieldEffects.OwnStealthRock > 0 And p.Ability.Name.ToLower() <> "magic guard" Then + Dim rocksDamage As Double = 1D - Dim effectiveness As Single = BattleCalculation.ReverseTypeEffectiveness(Element.GetElementMultiplier(New Element(Element.Types.Rock), p.Type1)) * BattleCalculation.ReverseTypeEffectiveness(Element.GetElementMultiplier(New Element(Element.Types.Rock), p.Type2)) - Select Case effectiveness - Case 0.25F - rocksDamage = (p.MaxHP / 100) * 3.125D - Case 0.5F - rocksDamage = (p.MaxHP / 100) * 6.25D - Case 1.0F - rocksDamage = (p.MaxHP / 100) * 12.5D - Case 2.0F - rocksDamage = (p.MaxHP / 100) * 25D - Case 4.0F - rocksDamage = (p.MaxHP / 100) * 50D - End Select + Dim effectiveness As Single = BattleCalculation.ReverseTypeEffectiveness(Element.GetElementMultiplier(New Element(Element.Types.Rock), p.Type1)) * BattleCalculation.ReverseTypeEffectiveness(Element.GetElementMultiplier(New Element(Element.Types.Rock), p.Type2)) + Select Case effectiveness + Case 0.25F + rocksDamage = (p.MaxHP / 100) * 3.125D + Case 0.5F + rocksDamage = (p.MaxHP / 100) * 6.25D + Case 1.0F + rocksDamage = (p.MaxHP / 100) * 12.5D + Case 2.0F + rocksDamage = (p.MaxHP / 100) * 25D + Case 4.0F + rocksDamage = (p.MaxHP / 100) * 50D + End Select - ReduceHP(CInt(rocksDamage), False, True, BattleScreen, "The Stealth Rocks hurt " & p.GetDisplayName() & "!", "stealthrocks") - End If - End If + ReduceHP(CInt(rocksDamage), False, True, BattleScreen, "The Stealth Rocks hurt " & p.GetDisplayName() & "!", "stealthrocks") + End If + End If - TriggerAbilityEffect(BattleScreen, False) - TriggerItemEffect(BattleScreen, False) + TriggerAbilityEffect(BattleScreen, False) + TriggerItemEffect(BattleScreen, False) - If .OppPokemon.Status = Pokemon.StatusProblems.Sleep Then - .FieldEffects.OppSleepTurns = Core.Random.Next(1, 4) - End If + If .OppPokemon.Status = Pokemon.StatusProblems.Sleep Then + .FieldEffects.OppSleepTurns = Core.Random.Next(1, 4) + End If - If BattleScreen.FieldEffects.OppHealingWish = True Then - BattleScreen.FieldEffects.OppHealingWish = False + If BattleScreen.FieldEffects.OppHealingWish = True Then + BattleScreen.FieldEffects.OppHealingWish = False - If .OppPokemon.HP < .OppPokemon.MaxHP Or .OppPokemon.Status <> Pokemon.StatusProblems.None Then - GainHP(.OppPokemon.MaxHP - .OppPokemon.HP, False, False, BattleScreen, "The Healing Wish came true for " & .OppPokemon.GetDisplayName() & "!", "move:healingwish") - CureStatusProblem(False, False, BattleScreen, "", "move:healingwish") - End If - End If - End With - End Sub + If .OppPokemon.HP < .OppPokemon.MaxHP Or .OppPokemon.Status <> Pokemon.StatusProblems.None Then + GainHP(.OppPokemon.MaxHP - .OppPokemon.HP, False, False, BattleScreen, "The Healing Wish came true for " & .OppPokemon.GetDisplayName() & "!", "move:healingwish") + CureStatusProblem(False, False, BattleScreen, "", "move:healingwish") + End If + End If + End With + End Sub #End Region #Region "EndBattle" - Enum EndBattleReasons - WinWild - LoseWild - WinTrainer - LoseTrainer - WinPvP - LosePvP - End Enum + Enum EndBattleReasons + WinWild + LoseWild + WinTrainer + LoseTrainer + WinPvP + LosePvP + End Enum - Public Sub EndBattle(ByVal reason As EndBattleReasons, ByVal BattleScreen As BattleScreen, ByVal AddPVP As Boolean) - BattleScreen.OwnFaint = False - BattleScreen.OppFaint = False - IsAfterFaint = False - If AddPVP = True Then - Select Case reason - Case EndBattleReasons.WinTrainer 'Lost - Dim q As New CameraQueryObject(New Vector3(12, 0, 13), Screen.Camera.Position, 0.03F, 0.03F, (MathHelper.Pi * 0.5F), Screen.Camera.Yaw, 0.0F, Screen.Camera.Pitch, 0.02F, 0.02F) - q.ApplyCurrentCamera = True - BattleScreen.TempPVPBattleQuery.Add(BattleScreen.BattleQuery.Count - 5, q) + Public Sub EndBattle(ByVal reason As EndBattleReasons, ByVal BattleScreen As BattleScreen, ByVal AddPVP As Boolean) + BattleScreen.OwnFaint = False + BattleScreen.OppFaint = False + IsAfterFaint = False + If AddPVP = True Then + Select Case reason + Case EndBattleReasons.WinTrainer 'Lost + Dim q As New CameraQueryObject(New Vector3(12, 0, 13), Screen.Camera.Position, 0.03F, 0.03F, (MathHelper.Pi * 0.5F), Screen.Camera.Yaw, 0.0F, Screen.Camera.Pitch, 0.02F, 0.02F) + q.ApplyCurrentCamera = True + BattleScreen.TempPVPBattleQuery.Add(BattleScreen.BattleQuery.Count - 5, q) - BattleScreen.TempPVPBattleQuery.Add(BattleScreen.BattleQuery.Count - 4, New TextQueryObject("You lost the battle!")) - BattleScreen.TempPVPBattleQuery.Add(BattleScreen.BattleQuery.Count - 3, New TextQueryObject("")) - BattleScreen.TempPVPBattleQuery.Add(BattleScreen.BattleQuery.Count - 2, New TextQueryObject("")) + BattleScreen.TempPVPBattleQuery.Add(BattleScreen.BattleQuery.Count - 4, New TextQueryObject("You lost the battle!")) + BattleScreen.TempPVPBattleQuery.Add(BattleScreen.BattleQuery.Count - 3, New TextQueryObject("")) + BattleScreen.TempPVPBattleQuery.Add(BattleScreen.BattleQuery.Count - 2, New TextQueryObject("")) - BattleScreen.TempPVPBattleQuery.Add(BattleScreen.BattleQuery.Count - 1, New EndBattleQueryObject(True)) - Case EndBattleReasons.LoseTrainer 'Won - Dim q As New CameraQueryObject(New Vector3(15, 0, 13), Screen.Camera.Position, 0.03F, 0.03F, -(MathHelper.Pi * 0.5F), Screen.Camera.Yaw, 0.0F, Screen.Camera.Pitch, 0.02F, 0.02F) - q.ApplyCurrentCamera = True - BattleScreen.TempPVPBattleQuery.Add(BattleScreen.BattleQuery.Count - 3, q) + BattleScreen.TempPVPBattleQuery.Add(BattleScreen.BattleQuery.Count - 1, New EndBattleQueryObject(True)) + Case EndBattleReasons.LoseTrainer 'Won + Dim q As New CameraQueryObject(New Vector3(15, 0, 13), Screen.Camera.Position, 0.03F, 0.03F, -(MathHelper.Pi * 0.5F), Screen.Camera.Yaw, 0.0F, Screen.Camera.Pitch, 0.02F, 0.02F) + q.ApplyCurrentCamera = True + BattleScreen.TempPVPBattleQuery.Add(BattleScreen.BattleQuery.Count - 3, q) - BattleScreen.TempPVPBattleQuery.Add(BattleScreen.BattleQuery.Count - 2, New TextQueryObject("Pokémon Trainer " & Core.Player.Name & " was defeated!")) + BattleScreen.TempPVPBattleQuery.Add(BattleScreen.BattleQuery.Count - 2, New TextQueryObject("Pokémon Trainer " & Core.Player.Name & " was defeated!")) - BattleScreen.TempPVPBattleQuery.Add(BattleScreen.BattleQuery.Count - 1, New EndBattleQueryObject(True)) - End Select - Else - Select Case reason - Case EndBattleReasons.WinWild - Won = True - Core.Player.AddPoints(1, "Won against wild Pokémon.") + BattleScreen.TempPVPBattleQuery.Add(BattleScreen.BattleQuery.Count - 1, New EndBattleQueryObject(True)) + End Select + Else + Select Case reason + Case EndBattleReasons.WinWild + Won = True + Core.Player.AddPoints(1, "Won against wild Pokémon.") - BattleScreen.BattleQuery.Add(New PlayMusicQueryObject("wild_defeat")) - ChangeCameraAngle(1, True, BattleScreen) + BattleScreen.BattleQuery.Add(New PlayMusicQueryObject("wild_defeat")) + ChangeCameraAngle(1, True, BattleScreen) - GainEXP(BattleScreen) + GainEXP(BattleScreen) - If BattleScreen.FieldEffects.OwnPayDayCounter > 0 Then - Core.Player.Money += BattleScreen.FieldEffects.OwnPayDayCounter - BattleScreen.BattleQuery.Add(New TextQueryObject(Core.Player.Name & " picked up $" & BattleScreen.FieldEffects.OwnPayDayCounter & "!")) - End If + If BattleScreen.FieldEffects.OwnPayDayCounter > 0 Then + Core.Player.Money += BattleScreen.FieldEffects.OwnPayDayCounter + BattleScreen.BattleQuery.Add(New TextQueryObject(Core.Player.Name & " picked up $" & BattleScreen.FieldEffects.OwnPayDayCounter & "!")) + End If - BattleScreen.BattleQuery.Add(New EndBattleQueryObject(False)) - Case EndBattleReasons.WinTrainer - Won = True - Core.Player.AddPoints(3, "Won against trainer.") + BattleScreen.BattleQuery.Add(New EndBattleQueryObject(False)) + Case EndBattleReasons.WinTrainer + Won = True + Core.Player.AddPoints(3, "Won against trainer.") - Core.Player.Money += BattleScreen.GetTrainerMoney() + Core.Player.Money += BattleScreen.GetTrainerMoney() - BattleScreen.BattleQuery.Add(New PlayMusicQueryObject(BattleScreen.Trainer.GetDefeatMusic())) + BattleScreen.BattleQuery.Add(New PlayMusicQueryObject(BattleScreen.Trainer.GetDefeatMusic())) - Dim q As New CameraQueryObject(New Vector3(15, 0, 13), Screen.Camera.Position, 0.03F, 0.03F, -(MathHelper.Pi * 0.5F), Screen.Camera.Yaw, 0.0F, Screen.Camera.Pitch, 0.04F, 0.02F) - q.ApplyCurrentCamera = True - BattleScreen.BattleQuery.Add(q) + Dim q As New CameraQueryObject(New Vector3(15, 0, 13), Screen.Camera.Position, 0.03F, 0.03F, -(MathHelper.Pi * 0.5F), Screen.Camera.Yaw, 0.0F, Screen.Camera.Pitch, 0.04F, 0.02F) + q.ApplyCurrentCamera = True + BattleScreen.BattleQuery.Add(q) - BattleScreen.BattleQuery.Add(New TextQueryObject(BattleScreen.Trainer.TrainerType & " " & BattleScreen.Trainer.Name & " was defeated!")) - BattleScreen.BattleQuery.Add(New TextQueryObject(BattleScreen.Trainer.OutroMessage)) + BattleScreen.BattleQuery.Add(New TextQueryObject(BattleScreen.Trainer.TrainerType & " " & BattleScreen.Trainer.Name & " was defeated!")) + BattleScreen.BattleQuery.Add(New TextQueryObject(BattleScreen.Trainer.OutroMessage)) - If BattleScreen.GetTrainerMoney() > 0 Then - BattleScreen.BattleQuery.Add(New TextQueryObject(Core.Player.Name & " got $" & BattleScreen.GetTrainerMoney() & "!")) - End If + If BattleScreen.GetTrainerMoney() > 0 Then + BattleScreen.BattleQuery.Add(New TextQueryObject(Core.Player.Name & " got $" & BattleScreen.GetTrainerMoney() & "!")) + End If - BattleScreen.BattleQuery.Add(New EndBattleQueryObject(False)) - Case EndBattleReasons.LoseTrainer, EndBattleReasons.LoseWild - Won = False + BattleScreen.BattleQuery.Add(New EndBattleQueryObject(False)) + Case EndBattleReasons.LoseTrainer, EndBattleReasons.LoseWild + Won = False Dim q As New CameraQueryObject(New Vector3(12, 0, 13), Screen.Camera.Position, 0.03F, 0.03F, (MathHelper.Pi * 0.5F), Screen.Camera.Yaw, 0.0F, Screen.Camera.Pitch, 0.02F, 0.02F) q.ApplyCurrentCamera = True BattleScreen.BattleQuery.Add(q) diff --git a/P3D/Battle/BattleSystemV2/QueryObjects/AnimationQueryObject.vb b/P3D/Battle/BattleSystemV2/QueryObjects/AnimationQueryObject.vb index 75e95027d..84eca1a23 100644 --- a/P3D/Battle/BattleSystemV2/QueryObjects/AnimationQueryObject.vb +++ b/P3D/Battle/BattleSystemV2/QueryObjects/AnimationQueryObject.vb @@ -5,7 +5,7 @@ Public AnimationStarted As Boolean = False Public AnimationEnded As Boolean = False - Public BAFlipped As Boolean + Public BattleFlipped As Boolean = Nothing Public AnimationSequence As List(Of BattleAnimation3D) Public SpawnedEntities As List(Of Entity) Public CurrentEntity As Entity @@ -17,10 +17,12 @@ End Get End Property - Public Sub New(ByVal entity As Entity, ByVal BAFlipped As Boolean, Optional ByVal model As ModelEntity = Nothing) + Public Sub New(ByVal entity As Entity, ByVal BattleFlipped As Boolean, Optional ByVal model As ModelEntity = Nothing) MyBase.New(QueryTypes.MoveAnimation) Me.AnimationSequence = New List(Of BattleAnimation3D) - Me.BAFlipped = BAFlipped + If BattleFlipped <> Nothing Then + Me.BattleFlipped = BattleFlipped + End If Me.CurrentEntity = entity Me.CurrentModel = model AnimationSequenceBegin() @@ -48,6 +50,9 @@ i -= 1 AnimationSequence.Remove(a) Else + If a.SpawnedEntity IsNot Nothing And a.Ready = True Then + SpawnedEntities.Add(a.SpawnedEntity) + End If a.Update() End If End If @@ -70,32 +75,32 @@ End Sub Public Sub AnimationSequenceEnd() - If CurrentEntity Is Nothing Then - Logger.Log(Logger.LogTypes.Warning, "ATTEMPT TO USE AnimationSequenceEnd OUTSIDE OF ATTACK ANIMATION DELEGATE") - ElseIf Not AnimationStarted Then - Logger.Log(Logger.LogTypes.Warning, "ATTEMPT TO USE AnimationSequenceEnd BEFORE CALLING AnimationSequenceBegin") - Else - AnimationEnded = True - End If + AnimationEnded = True 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 + Public Function SpawnEntity(ByVal Position As Vector3, ByVal Texture As Texture2D, ByVal Scale As Vector3, ByVal Opacity As Single, Optional ByVal startDelay As Single = 0.0F, Optional ByVal endDelay As Single = 0.0F) As Entity + If Not BattleFlipped = Nothing Then + If BattleFlipped = True Then + Position.X = CurrentEntity.Position.X - Position.X * 2.0F + Position.Z = CurrentEntity.Position.Z - Position.Z * 2.0F + Else + Position.X = CurrentEntity.Position.X + Position.X * 2.0F + Position.Z = CurrentEntity.Position.Z + Position.Z * 2.0F + End If End If - SpawnedEntities.Add(SpawnedEntity) + 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 + + Dim SpawnDelayEntity As BattleAnimation3D = New BattleAnimation3D(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay, SpawnedEntity) + + AnimationSequence.Add(SpawnDelayEntity) 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) + Public Sub ChangeEntityTexture(ByVal Entity As Entity, RemoveEntityAfter As Boolean, ByVal Texture As Texture2D, ByVal startDelay As Single, ByVal endDelay As Single) Dim TextureChangeEntity As Entity If Entity Is Nothing Then @@ -106,19 +111,29 @@ Dim baEntityTextureChange As BAEntityTextureChange = New BAEntityTextureChange(TextureChangeEntity, Texture, startDelay, endDelay) AnimationSequence.Add(baEntityTextureChange) + + If RemoveEntityAfter = True Then + If baEntityTextureChange.CanRemove = True Then + RemoveEntity(Entity) + End If + End If 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) + Public Sub MoveEntity(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, 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 + If Not BattleFlipped = Nothing Then + If BattleFlipped = True 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 + If Entity Is Nothing Then + MoveEntity = CurrentEntity + Else + MoveEntity = Entity + End If + Destination = CurrentEntity.Position + New Vector3(DestinationX, DestinationY, DestinationZ) Else MoveEntity = Entity Destination = New Vector3(DestinationX, DestinationY, DestinationZ) @@ -131,9 +146,15 @@ Dim baModelMove As BAEntityMove = New BAEntityMove(CType(CurrentModel, Entity), Destination, Speed, SpinX, SpinZ, startDelay, endDelay, SpinXSpeed, SpinZSpeed, MovementCurve) AnimationSequence.Add(baModelMove) End If + + If RemoveEntityAfter = True Then + If baEntityMove.CanRemove = True Then + RemoveEntity(Entity) + End If + 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) + Public Sub FadeEntity(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, 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 @@ -148,8 +169,14 @@ Dim baModelOpacity As BAEntityOpacity = New BAEntityOpacity(CType(CurrentModel, Entity), TransitionSpeed, FadeIn, EndState, startDelay, endDelay, startState) AnimationSequence.Add(baModelOpacity) End If + + If RemoveEntityAfter = True Then + If baEntityOpacity.CanRemove = True Then + RemoveEntity(Entity) + End If + 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) + Public Sub RotateEntity(Entity As Entity, ByVal RemoveEntityAfter As Boolean, 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 @@ -161,8 +188,13 @@ 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) + If RemoveEntityAfter = True Then + If baEntityRotate.CanRemove = True Then + RemoveEntity(Entity) + End If + End If 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") + Public Sub ScaleEntity(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, 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 @@ -175,6 +207,11 @@ 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) + If RemoveEntityAfter = True Then + If baBillSize.CanRemove = True Then + RemoveEntity(Entity) + End If + End If 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) @@ -193,7 +230,7 @@ texture2D = TextureManager.GetTexture(stringArray(0), r, "") End If - If BAFlipped Then + If BattleFlipped Then PositionX -= PositionX * 2.0F PositionZ -= PositionZ * 2.0F End If @@ -222,7 +259,7 @@ texture2D = TextureManager.GetTexture(stringArray(0), r, "") End If - If BAFlipped Then + If BattleFlipped Then PositionX -= PositionX * 2.0F PositionZ -= PositionZ * 2.0F DestinationX -= DestinationX * 2.0F @@ -239,7 +276,7 @@ AnimationSequence.Add(baMove) 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) + Public Sub PlaySound(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") ElseIf Not AnimationStarted Then diff --git a/P3D/Content/Textures/Battle/Cloud.png b/P3D/Content/Textures/Battle/Smoke.png similarity index 100% rename from P3D/Content/Textures/Battle/Cloud.png rename to P3D/Content/Textures/Battle/Smoke.png diff --git a/P3D/Entites/Entity.vb b/P3D/Entites/Entity.vb index 998344643..99d766dfc 100644 --- a/P3D/Entites/Entity.vb +++ b/P3D/Entites/Entity.vb @@ -22,6 +22,7 @@ Public Visible As Boolean = True Public Shader As New Vector3(1.0F) Public Shaders As New List(Of Vector3) + Public Color As Vector3 = New Vector3(1.0F) Public CameraDistanceDelta As Single = 0.0F diff --git a/P3D/P3D.vbproj b/P3D/P3D.vbproj index ec16b862f..a3208c826 100644 --- a/P3D/P3D.vbproj +++ b/P3D/P3D.vbproj @@ -15403,6 +15403,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest @@ -26269,9 +26272,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest @@ -27545,6 +27545,7 @@ PreserveNewest + diff --git a/P3D/Pokemon/Attacks/Fire/Ember.vb b/P3D/Pokemon/Attacks/Fire/Ember.vb index 6719f780d..03a9cfffc 100644 --- a/P3D/Pokemon/Attacks/Fire/Ember.vb +++ b/P3D/Pokemon/Attacks/Fire/Ember.vb @@ -66,7 +66,7 @@ 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) MoveAnimation.AnimationSpawnMovingEntity(0.0, 0, 0.0, "Textures\Battle\Fire\FireBall", 0.5, 0.5, 0.5, 2.0, 0.0, 0.0, 0.05, False, True, 0.0, 0.0,, -0.5, 0) - MoveAnimation.AnimationPlaySound("Battle\Attacks\Fire\Ember_Start", 0, 0) + MoveAnimation.PlaySound("Battle\Attacks\Fire\Ember_Start", 0, 0) For i = 0 To 12 MoveAnimation.AnimationSpawnFadingEntity(CSng(i * 0.2), 0.0, 0.0, "Textures\Battle\Fire\Smoke", 0.2, 0.2, 0.2, 0.02, False, 0.0, CSng(i * 0.2), 0.0) i += 1 @@ -82,7 +82,7 @@ MoveAnimation.AnimationSpawnFadingEntity(CSng(3.0 - i * 0.2), 0.0, 0.0, "Textures\Battle\Fire\Smoke", 0.2, 0.2, 0.2, 0.02, False, 0.0, CSng(i * 0.2), 0.0) i += 1 Next - MoveAnimation.AnimationPlaySound("Battle\Attacks\Fire\Ember_Hit", 2, 0) + MoveAnimation.PlaySound("Battle\Attacks\Fire\Ember_Hit", 2, 0) MoveAnimation.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) MoveAnimation.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) MoveAnimation.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) diff --git a/P3D/Pokemon/Attacks/Grass/Absorb.vb b/P3D/Pokemon/Attacks/Grass/Absorb.vb index a63495b58..6b8075175 100644 --- a/P3D/Pokemon/Attacks/Grass/Absorb.vb +++ b/P3D/Pokemon/Attacks/Grass/Absorb.vb @@ -96,7 +96,7 @@ Dim MoveAnimation As AnimationQueryObject = New AnimationQueryObject(CurrentEntity, own) Dim maxAmount As Integer = 8 Dim currentAmount As Integer = 0 - MoveAnimation.AnimationPlaySound("Battle\Attacks\Grass\Absorb", 0, 0) + MoveAnimation.PlaySound("Battle\Attacks\Grass\Absorb", 0, 0) While currentAmount <= maxAmount Dim yPos As Single = CSng(Random.NextDouble() * 0.5) Dim zPos As Single = CSng(Random.Next(-5, 5) * 0.15) diff --git a/P3D/Pokemon/Attacks/Normal/Growl.vb b/P3D/Pokemon/Attacks/Normal/Growl.vb index 5c35961e3..e01dafc73 100644 --- a/P3D/Pokemon/Attacks/Normal/Growl.vb +++ b/P3D/Pokemon/Attacks/Normal/Growl.vb @@ -64,7 +64,7 @@ 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) - MoveAnimation.AnimationPlaySound(CStr(CurrentPokemon.Number), 0, 0,, True) + MoveAnimation.PlaySound(CStr(CurrentPokemon.Number), 0, 0,, True) MoveAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Normal\Growl,0,0,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 0, 1) MoveAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Normal\Growl,0,32,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 1, 1) MoveAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Normal\Growl,0,0,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 2, 1) diff --git a/P3D/Pokemon/Attacks/Normal/Pound.vb b/P3D/Pokemon/Attacks/Normal/Pound.vb index 25785556e..5cf85b3e2 100644 --- a/P3D/Pokemon/Attacks/Normal/Pound.vb +++ b/P3D/Pokemon/Attacks/Normal/Pound.vb @@ -57,7 +57,7 @@ Public Overrides Sub InternalOpponentPokemonMoveAnimation(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) - MoveAnimation.AnimationPlaySound("Battle\Attacks\Pound", 0.5, 2.5) + MoveAnimation.PlaySound("Battle\Attacks\Pound", 0.5, 2.5) MoveAnimation.AnimationSpawnFadingEntity(0, -0.25, 0, "Textures\Battle\Normal\Pound", 0.5, 0.5, 0.5, 0.02, False, 1.0, 0, 3) BattleScreen.BattleQuery.Add(MoveAnimation) End Sub diff --git a/P3D/Pokemon/Attacks/Normal/Tackle.vb b/P3D/Pokemon/Attacks/Normal/Tackle.vb index 4d53f749d..99e61e709 100644 --- a/P3D/Pokemon/Attacks/Normal/Tackle.vb +++ b/P3D/Pokemon/Attacks/Normal/Tackle.vb @@ -54,15 +54,16 @@ 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.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) + MoveAnimation.MoveEntity(Nothing, False, 0.5, 0, 0, 0.3, False, False, 0, 0,,, 2) + MoveAnimation.MoveEntity(Nothing, False, 0, 0, 0, 0.3, False, False, 1, 0,,, 2) BattleScreen.BattleQuery.Add(MoveAnimation) End Sub Public Overrides Sub InternalOpponentPokemonMoveAnimation(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) - MoveAnimation.AnimationPlaySound("Battle\Attacks\Normal\Tackle", 0, 2) - MoveAnimation.AnimationSpawnFadingEntity(0, -0.25, 0, "Textures\Battle\Normal\Tackle", 0.5, 0.5, 0.5, 0.02, False, 1.0, 0, 2) + MoveAnimation.PlaySound("Battle\Attacks\Normal\Tackle", 0, 2) + Dim SpawnEntity = MoveAnimation.SpawnEntity(New Vector3(0, -0.25, 0), TextureManager.GetTexture("Textures\Battle\Normal\Tackle"), New Vector3(1.0F), 1.0F) + MoveAnimation.FadeEntity(SpawnEntity, True, 0.02, False, 1.0F, 0, 2) BattleScreen.BattleQuery.Add(MoveAnimation) End Sub End Class diff --git a/P3D/Pokemon/Attacks/Poison/PoisonSting.vb b/P3D/Pokemon/Attacks/Poison/PoisonSting.vb index 9684f8379..3cc76f0a4 100644 --- a/P3D/Pokemon/Attacks/Poison/PoisonSting.vb +++ b/P3D/Pokemon/Attacks/Poison/PoisonSting.vb @@ -67,30 +67,38 @@ 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) - MoveAnimation.AnimationSpawnMovingEntity(0.0, 0, 0.0, "Textures\Battle\Poison\Stinger", 0.5, 0.5, 0.5, 2.0, 0.0, 0.0, 0.05, False, False, 0.0, 0.0,,, 0) - MoveAnimation.AnimationPlaySound("Battle\Attacks\Poison\PoisonSting_Start", 0, 0) + Dim StingerEntity As Entity = MoveAnimation.SpawnEntity(CurrentEntity.Position, TextureManager.GetTexture("Textures\Battle\Poison\Stinger"), New Vector3(0.5F), 1.0F) + + MoveAnimation.PlaySound("Battle\Attacks\Poison\PoisonSting_Start", 0, 0) + MoveAnimation.MoveEntity(StingerEntity, True, 2.0, 0.0, 0.0, 0.05, False, False, 0.0, 0.0,,, 0) + BattleScreen.BattleQuery.Add(MoveAnimation) End Sub Public Overrides Sub InternalOpponentPokemonMoveAnimation(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) - MoveAnimation.AnimationSpawnMovingEntity(2.0, 0, 0.0, "Textures\Battle\Poison\Stinger", 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.05, False, False, 0.0, 0.0,,, 0) + Dim StingerEntity As Entity = MoveAnimation.SpawnEntity(New Vector3(2.0, 0, 0.0), TextureManager.GetTexture("Textures\Battle\Poison\Stinger"), New Vector3(0.5F), 1) - MoveAnimation.AnimationPlaySound("Battle\Attacks\Poison\PoisonSting_Hit", 1, 0) - MoveAnimation.AnimationSpawnFadingEntity(-0.25, -0.25, -0.25, "Textures\Battle\Poison\Bubble,0,0,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 1, 1) + MoveAnimation.MoveEntity(StingerEntity, True, 0.0, 0.0, 0.0, 0.05, False, False, 0.0, 0.0,,, 0) - MoveAnimation.AnimationSpawnFadingEntity(-0.25, -0.25, -0.25, "Textures\Battle\Poison\Bubble,0,32,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 2, 1) - MoveAnimation.AnimationSpawnFadingEntity(0.25, -0.25, 0.25, "Textures\Battle\Poison\Bubble,0,0,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 2, 1) + MoveAnimation.PlaySound("Battle\Attacks\Poison\PoisonSting_Hit", 1, 0) - MoveAnimation.AnimationSpawnFadingEntity(-0.25, -0.25, -0.25, "Textures\Battle\Poison\Bubble,0,64,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 3, 1) - MoveAnimation.AnimationSpawnFadingEntity(0.25, -0.25, 0.25, "Textures\Battle\Poison\Bubble,0,32,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 3, 1) - MoveAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Poison\Bubble,0,0,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 3, 1) + Dim BubbleEntity1 As Entity = MoveAnimation.SpawnEntity(New Vector3(-0.25, -0.25, -0.25), TextureManager.GetTexture("Textures\Battle\Poison\Bubble", New Rectangle(0, 0, 32, 32)), New Vector3(0.5F), 1, 1, 1) - MoveAnimation.AnimationSpawnFadingEntity(0.25, -0.25, 0.25, "Textures\Battle\Poison\Bubble,0,64,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 4, 1) - MoveAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Poison\Bubble,0,32,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 4, 1) + MoveAnimation.ChangeEntityTexture(BubbleEntity1, False, TextureManager.GetTexture("Textures\Battle\Poison\Bubble", New Rectangle(0, 32, 32, 32)), 2, 1) - MoveAnimation.AnimationSpawnFadingEntity(0.25, -0.25, -0.25, "Textures\Battle\Poison\Bubble,0,64,32,32", 0.5, 0.5, 0.5, 0.02, False, 1.0, 5, 2) + Dim BubbleEntity2 As Entity = MoveAnimation.SpawnEntity(New Vector3(0.25, -0.25, 0.25), TextureManager.GetTexture("Textures\Battle\Poison\Bubble", New Rectangle(0, 0, 32, 32)), New Vector3(0.5F), 1, 2, 1) + + MoveAnimation.ChangeEntityTexture(BubbleEntity1, True, TextureManager.GetTexture("Textures\Battle\Poison\Bubble", New Rectangle(0, 64, 32, 32)), 3, 1) + MoveAnimation.ChangeEntityTexture(BubbleEntity2, False, TextureManager.GetTexture("Textures\Battle\Poison\Bubble", New Rectangle(0, 32, 32, 32)), 3, 1) + + Dim BubbleEntity3 As Entity = MoveAnimation.SpawnEntity(New Vector3(0.25, -0.25, -0.25), TextureManager.GetTexture("Textures\Battle\Poison\Bubble", New Rectangle(0, 0, 32, 32)), New Vector3(0.5F), 1, 3, 1) + + MoveAnimation.ChangeEntityTexture(BubbleEntity2, True, TextureManager.GetTexture("Textures\Battle\Poison\Bubble", New Rectangle(0, 64, 32, 32)), 4, 1) + MoveAnimation.ChangeEntityTexture(BubbleEntity3, False, TextureManager.GetTexture("Textures\Battle\Poison\Bubble", New Rectangle(0, 32, 32, 32)), 4, 1) + + MoveAnimation.ChangeEntityTexture(BubbleEntity3, True, TextureManager.GetTexture("Textures\Battle\Poison\Bubble", New Rectangle(0, 64, 32, 32)), 5, 1) BattleScreen.BattleQuery.Add(MoveAnimation) End Sub diff --git a/P3D/Resources/Models/BaseModel.vb b/P3D/Resources/Models/BaseModel.vb index 92ae430c2..c10890d7d 100644 --- a/P3D/Resources/Models/BaseModel.vb +++ b/P3D/Resources/Models/BaseModel.vb @@ -15,7 +15,7 @@ Screen.Effect.TextureEnabled = True Screen.Effect.Alpha = Entity.Opacity - Screen.Effect.DiffuseColor = effectDiffuseColor * Entity.Shader + Screen.Effect.DiffuseColor = effectDiffuseColor * Entity.Shader * Entity.Color If Screen.Level.IsDark = True Then Screen.Effect.DiffuseColor *= New Vector3(0.5, 0.5, 0.5) @@ -70,7 +70,9 @@ End If Screen.Effect.DiffuseColor = effectDiffuseColor - If DebugDisplay.MaxDistance < Entity.CameraDistance Then DebugDisplay.MaxDistance = CInt(Entity.CameraDistance) + If DebugDisplay.MaxDistance < Entity.CameraDistance Then + DebugDisplay.MaxDistance = CInt(Entity.CameraDistance) + End If End Sub Private Sub ApplyTexture(ByVal texture As Texture2D) diff --git a/P3D/Screens/Battle/BattleCatchScreen.vb b/P3D/Screens/Battle/BattleCatchScreen.vb index 787d1e9b0..75ea37b7a 100644 --- a/P3D/Screens/Battle/BattleCatchScreen.vb +++ b/P3D/Screens/Battle/BattleCatchScreen.vb @@ -4,9 +4,11 @@ Dim Ball As Item - 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 Animations As BattleSystem.AnimationQueryObject = New BattleSystem.AnimationQueryObject(BattleScreen.OppPokemonNPC, Nothing, BattleScreen.OppPokemonModel) + Dim BallStartPosition As Vector3 = New Vector3(Camera.Position.X - 1.0F, Camera.Position.Y, Camera.Position.Z - 1.0F) + BattleScreen.BattleMapOffset + Dim BallEntity As Entity = Nothing + + Dim PokemonScale As Vector3 Dim AnimationStarted As Boolean = False Dim caught As Boolean = False @@ -104,15 +106,15 @@ If TextBox.Showing = False Then - If Me._playIntroSound = False Then - Me._playIntroSound = True - SoundManager.PlaySound("Battle\Pokeball\throw") - End If - UpdateAnimations() If Me.IsCurrentScreen() = True Then If AnimationStarted = False Then + If Me._playIntroSound = False Then + Me._playIntroSound = True + SoundManager.PlaySound("Battle\Pokeball\throw") + End If + BallEntity = Animations.SpawnEntity(BallStartPosition, Ball.Texture, New Vector3(0.3F), 1.0F) SetupAnimation() Else Select Case Me.AnimationIndex @@ -131,7 +133,7 @@ SoundManager.PlaySound("Battle\Pokeball\shake") AnimationIndex += 1 Else - SoundManager.PlaySound("Battle\Pokeball\open") + SoundManager.PlaySound("Battle\Pokeball\break") AnimationIndex = 21 InBall = False End If @@ -177,7 +179,7 @@ ResetVisibility() Core.SetScreen(Me.PreScreen) Case 21 ' After Break - ResetVisibility() + SetupAnimation() 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 @@ -255,52 +257,68 @@ Select Case Me.AnimationIndex Case 0 - Animations.AnimationMoveEntity(BallEntity, BattleScreen.OppPokemonNPC.Position.X - 0.05F, 0.0F, BattleScreen.OppPokemonNPC.Position.Z, 0.04F, True, True, 1.0F, 0.0F,,, 3) + PokemonScale = BattleScreen.OppPokemonNPC.Scale + Animations.MoveEntity(BallEntity, False, BattleScreen.OppPokemonNPC.Position.X - 0.05F, 0.0F, BattleScreen.OppPokemonNPC.Position.Z, 0.1, False, True, 0F, 0F,, 0.3) Case 1 - Dim SmokeReturned As Integer = 0 + Dim SmokeParticles 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 SmokePosition = BattleScreen.OwnPokemonNPC.Position + New Vector3(CSng(Random.Next(-10, 10) / 10), CSng(Random.Next(-10, 10) / 10), CSng(Random.Next(-10, 10) / 10)) + Dim SmokeDestination = BattleScreen.OwnPokemonNPC.Position - Dim SmokeTexture As Texture2D = TextureManager.GetTexture("Textures\Battle\Cloud") + Dim SmokeTexture As Texture2D = TextureManager.GetTexture("Textures\Battle\Smoke") 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.MoveEntity(SmokeEntity, True, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 0.0F, 0.0F) - Animations.AnimationMoveEntity(BallEntity, BattleScreen.OppPokemonNPC.Position.X - 0.05F, 0.0F, BattleScreen.OppPokemonNPC.Position.Z, 0.01F, False, False, 0.0F, 6.0F,,, 3) + Threading.Interlocked.Increment(SmokeParticles) + Loop While SmokeParticles <= 38 - 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) + Animations.MoveEntity(BallEntity, False, BattleScreen.OppPokemonNPC.Position.X, BattleScreen.OwnPokemonNPC.Position.Y, BattleScreen.OppPokemonNPC.Position.Z, 0.01F, False, False, 0.0F, 6.0F,,, 3) + + Animations.ScaleEntity(Nothing, False, False, 0.05F, 0.05F, 0.05F, 0.02F, 0.0F, 0.0F, "1") + Animations.FadeEntity(Nothing, False, 1, False, 0.0F, 0.0F, 0.0F) Case 2 - Animations.AnimationMoveEntity(BallEntity, BattleScreen.OppPokemonNPC.Position.X - 0.05F, -0.35F, BattleScreen.OppPokemonNPC.Position.Z, 0.02F, False, False, 0.0F, 6.0F,,, 3) - + Animations.MoveEntity(BallEntity, False, BattleScreen.OppPokemonNPC.Position.X, BattleScreen.OwnPokemonNPC.Position.Y - 0.35F, BattleScreen.OppPokemonNPC.Position.Z, 0.02F, False, False, 0.0F, 6.0F,,, 3) Case 3, 5 - Animations.AnimationRotateEntity(BallEntity, 0, 0, 0.05F, 0, 0, 1.0F, 0.0F, 4.0F, False, False, True, True) + Animations.RotateEntity(BallEntity, False, 0, 0, 0.05F, 0, 0, 1.0F, 0.0F, 4.0F, False, False, True, True) Case 4, 6 - Animations.AnimationRotateEntity(BallEntity, 0, 0, -0.05F, 0, 0, -1.0F, 0.0F, 4.0F, False, False, True, True) + Animations.RotateEntity(BallEntity, False, 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 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 + Animations.MoveEntity(StarEntity, True, StarDestination.X, StarDestination.Y, StarDestination.Z, 0.01F, False, False, 0.0F, 0.0F,,, 3) Next - Animations.AnimationMoveEntity(BallEntity, BattleScreen.OppPokemonNPC.Position.X - 0.05F, -0.35F, BattleScreen.OppPokemonNPC.Position.Z, 0.02F, False, False, 0.0F, 6.0F,,, 3) + Animations.MoveEntity(BallEntity, False, BattleScreen.OppPokemonNPC.Position.X, BattleScreen.OwnPokemonNPC.Position.Y - 0.35F, BattleScreen.OppPokemonNPC.Position.Z, 0.02F, False, False, 0.0F, 6.0F,,, 3) Case 8 - Animations.AnimationFadeEntity(BallEntity, 0.01F, False, 0.0F, 0.0F, 0.0F) + Animations.FadeEntity(BallEntity, True, 0.01F, False, 0.0F, 0.0F, 0.0F) Case 21 ' Break Animation + ' Ball Opens + Dim SmokeParticles As Integer = 0 + Do + Dim SmokePosition = BattleScreen.OwnPokemonNPC.Position + Dim SmokeDestination = BattleScreen.OwnPokemonNPC.Position + New Vector3(CSng(Random.Next(-10, 10) / 10), CSng(Random.Next(-10, 10) / 10), CSng(Random.Next(-10, 10) / 10)) + + Dim SmokeTexture As Texture2D = TextureManager.GetTexture("Textures\Battle\Smoke") + + 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.MoveEntity(SmokeEntity, True, SmokeDestination.X, SmokeDestination.Y, SmokeDestination.Z, SmokeSpeed, False, False, 0.0F, 0.0F) + + Threading.Interlocked.Increment(SmokeParticles) + Loop While SmokeParticles <= 38 + + ' Pokemon appears + Animations.FadeEntity(Nothing, False, 1, False, 1, 0.0F, 0.0F) + Animations.ScaleEntity(Nothing, False, True, PokemonScale.X, PokemonScale.Y, PokemonScale.Z, 0.02F, 0.0F, 0.0F, "1") End Select End Sub