Fix for Invisible Pokémon in Battle
As well as some other fixes like the hit animation also working on models and making the timing more reliable
This commit is contained in:
parent
9fa9f93659
commit
7d55ca2c64
|
@ -24,7 +24,7 @@
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Overrides Sub Render()
|
Public Overrides Sub Render()
|
||||||
If startDelay = 0.0F AndAlso Me.BackgroundOpacity > 0.0F Then
|
If Date.Now >= startDelay AndAlso Me.BackgroundOpacity > 0.0F Then
|
||||||
Core.SpriteBatch.Draw(Me.Texture, New Rectangle(0, 0, windowSize.Width, windowSize.Height), New Color(255, 255, 255, CInt(255 * Me.BackgroundOpacity)))
|
Core.SpriteBatch.Draw(Me.Texture, New Rectangle(0, 0, windowSize.Width, windowSize.Height), New Color(255, 255, 255, CInt(255 * Me.BackgroundOpacity)))
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
Me.TransitionSpeed = TransitionSpeed
|
Me.TransitionSpeed = TransitionSpeed
|
||||||
Me.TargetEntity = entity
|
Me.TargetEntity = entity
|
||||||
|
|
||||||
Me.TargetEntity.Opacity = StartState
|
Me.TargetEntity.NormalOpacity = StartState
|
||||||
Me.Visible = False
|
Me.Visible = False
|
||||||
|
|
||||||
Me.AnimationType = AnimationTypes.Transition
|
Me.AnimationType = AnimationTypes.Transition
|
||||||
|
@ -24,22 +24,22 @@
|
||||||
|
|
||||||
Public Overrides Sub DoActionActive()
|
Public Overrides Sub DoActionActive()
|
||||||
If Me.FadeIn = True Then
|
If Me.FadeIn = True Then
|
||||||
If Me.EndState > TargetEntity.Opacity Then
|
If Me.EndState > TargetEntity.NormalOpacity Then
|
||||||
TargetEntity.Opacity += Me.TransitionSpeed
|
TargetEntity.NormalOpacity += Me.TransitionSpeed
|
||||||
If TargetEntity.Opacity >= Me.EndState Then
|
If TargetEntity.NormalOpacity >= Me.EndState Then
|
||||||
TargetEntity.Opacity = Me.EndState
|
TargetEntity.NormalOpacity = Me.EndState
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
If Me.EndState < TargetEntity.Opacity Then
|
If Me.EndState < TargetEntity.NormalOpacity Then
|
||||||
TargetEntity.Opacity -= Me.TransitionSpeed
|
TargetEntity.NormalOpacity -= Me.TransitionSpeed
|
||||||
If TargetEntity.Opacity <= Me.EndState Then
|
If TargetEntity.NormalOpacity <= Me.EndState Then
|
||||||
TargetEntity.Opacity = Me.EndState
|
TargetEntity.NormalOpacity = Me.EndState
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If TargetEntity.Opacity = Me.EndState Then
|
If TargetEntity.NormalOpacity = Me.EndState Then
|
||||||
Me.Ready = True
|
Me.Ready = True
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
|
@ -23,15 +23,23 @@
|
||||||
Public AnimationType As AnimationTypes = AnimationTypes.Nothing
|
Public AnimationType As AnimationTypes = AnimationTypes.Nothing
|
||||||
Public CanRemove As Boolean = False
|
Public CanRemove As Boolean = False
|
||||||
Public Ready As Boolean = False
|
Public Ready As Boolean = False
|
||||||
Public startDelay As Single
|
Public startDelay As Date
|
||||||
Public endDelay As Single
|
Public endDelay As Date
|
||||||
Public SpawnedEntity As Boolean = False
|
Public SpawnedEntity As Boolean = False
|
||||||
|
Public Started As Boolean = False
|
||||||
|
Private DelayDivide As Single = 6.0F
|
||||||
|
Private StartDelayWhole As Single
|
||||||
|
Private StartDelayFraction As Single
|
||||||
|
Private EndDelayWhole As Single
|
||||||
|
Private EndDelayFraction 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 Boolean = False)
|
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 Boolean = False)
|
||||||
MyBase.New(Position.X, Position.Y, Position.Z, "BattleAnimation", {Texture}, {0, 0}, False, 0, Scale, BaseModel.BillModel, 0, "", New Vector3(1.0F))
|
MyBase.New(Position.X, Position.Y, Position.Z, "BattleAnimation", {Texture}, {0, 0}, False, 0, Scale, BaseModel.BillModel, 0, "", New Vector3(1.0F))
|
||||||
|
|
||||||
Me.startDelay = startDelay
|
StartDelayWhole = CSng(Math.Truncate(CDbl(startDelay / DelayDivide)))
|
||||||
Me.endDelay = endDelay
|
StartDelayFraction = startDelay / DelayDivide - StartDelayWhole
|
||||||
|
EndDelayWhole = CSng(Math.Truncate(CDbl(endDelay / DelayDivide)))
|
||||||
|
EndDelayFraction = endDelay / DelayDivide - EndDelayWhole
|
||||||
|
|
||||||
Me.SpawnedEntity = SpawnedEntity
|
Me.SpawnedEntity = SpawnedEntity
|
||||||
|
|
||||||
|
@ -40,26 +48,19 @@
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Overrides Sub Update()
|
Public Overrides Sub Update()
|
||||||
|
If Started = False Then
|
||||||
|
Me.startDelay = Date.Now + New TimeSpan(0, 0, 0, CInt(StartDelayWhole), CInt(StartDelayFraction * 1000))
|
||||||
|
Me.endDelay = Date.Now + New TimeSpan(0, 0, 0, CInt(EndDelayWhole), CInt(EndDelayFraction * 1000))
|
||||||
|
Started = True
|
||||||
|
End If
|
||||||
If CanRemove = False Then
|
If CanRemove = False Then
|
||||||
If Ready = True Then
|
If Ready = True Then
|
||||||
If endDelay > 0.0F Then
|
If Date.Now >= endDelay Then
|
||||||
endDelay -= 0.1F
|
|
||||||
|
|
||||||
If endDelay <= 0.0F Then
|
|
||||||
endDelay = 0.0F
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
CanRemove = True
|
CanRemove = True
|
||||||
DoRemoveEntity()
|
DoRemoveEntity()
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
If startDelay > 0.0F Then
|
If Date.Now >= startDelay Then
|
||||||
startDelay -= 0.1F
|
|
||||||
|
|
||||||
If startDelay <= 0.0F Then
|
|
||||||
startDelay = 0.0F
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
If SpawnedEntity = True Then
|
If SpawnedEntity = True Then
|
||||||
Ready = True
|
Ready = True
|
||||||
Else
|
Else
|
||||||
|
@ -93,7 +94,7 @@
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Overrides Sub Render()
|
Public Overrides Sub Render()
|
||||||
If Me.startDelay <= 0.0F Then
|
If Date.Now >= startDelay Then
|
||||||
If CanRemove = False Then
|
If CanRemove = False Then
|
||||||
If Me.Model Is Nothing Then
|
If Me.Model Is Nothing Then
|
||||||
Draw(Me.BaseModel, Me.Textures, True)
|
Draw(Me.BaseModel, Me.Textures, True)
|
||||||
|
|
|
@ -4377,9 +4377,11 @@
|
||||||
Public Sub ReduceHP(ByVal HPAmount As Integer, ByVal own As Boolean, ByVal from As Boolean, ByVal BattleScreen As BattleScreen, ByVal message As String, ByVal cause As String, ByVal sound As String)
|
Public Sub ReduceHP(ByVal HPAmount As Integer, ByVal own As Boolean, ByVal from As Boolean, ByVal BattleScreen As BattleScreen, ByVal message As String, ByVal cause As String, ByVal sound As String)
|
||||||
Dim p As Pokemon = BattleScreen.OwnPokemon
|
Dim p As Pokemon = BattleScreen.OwnPokemon
|
||||||
Dim pNPC As Entity = BattleScreen.OwnPokemonNPC
|
Dim pNPC As Entity = BattleScreen.OwnPokemonNPC
|
||||||
|
Dim pModel As Entity = BattleScreen.OwnPokemonModel
|
||||||
If own = False Then
|
If own = False Then
|
||||||
p = BattleScreen.OppPokemon
|
p = BattleScreen.OppPokemon
|
||||||
pNPC = BattleScreen.OppPokemonNPC
|
pNPC = BattleScreen.OppPokemonNPC
|
||||||
|
pModel = BattleScreen.OppPokemonModel
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If p.HP > 0 And p.Status <> Pokemon.StatusProblems.Fainted Then
|
If p.HP > 0 And p.Status <> Pokemon.StatusProblems.Fainted Then
|
||||||
|
@ -4396,13 +4398,14 @@
|
||||||
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject(sound, False, 0.0F))
|
BattleScreen.BattleQuery.Add(New PlaySoundQueryObject(sound, False, 0.0F))
|
||||||
End If
|
End If
|
||||||
If Core.Player.ShowBattleAnimations <> 0 Then
|
If Core.Player.ShowBattleAnimations <> 0 Then
|
||||||
Dim HitAnimation As AnimationQueryObject = New AnimationQueryObject(pNPC, own)
|
Dim HitAnimation As AnimationQueryObject = New AnimationQueryObject(pNPC, own, pModel)
|
||||||
HitAnimation.AnimationFade(Nothing, False, 1, False, 0, 0, 0)
|
HitAnimation.AnimationFade(Nothing, False, 1, False, 0, 0, 0)
|
||||||
HitAnimation.AnimationFade(Nothing, False, 1, True, 1, 1, 0)
|
HitAnimation.AnimationFade(Nothing, False, 1, True, 1, 1, 0)
|
||||||
HitAnimation.AnimationFade(Nothing, False, 1, False, 0, 2, 0)
|
HitAnimation.AnimationFade(Nothing, False, 1, False, 0, 2, 0)
|
||||||
HitAnimation.AnimationFade(Nothing, False, 1, True, 1, 3, 0)
|
HitAnimation.AnimationFade(Nothing, False, 1, True, 1, 3, 0)
|
||||||
BattleScreen.BattleQuery.Add(HitAnimation)
|
BattleScreen.BattleQuery.Add(HitAnimation)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If own = True Then
|
If own = True Then
|
||||||
BattleScreen.BattleQuery.Add(New MathHPQueryObject(p.HP, p.MaxHP, HPAmount, New Vector2(200, 256)))
|
BattleScreen.BattleQuery.Add(New MathHPQueryObject(p.HP, p.MaxHP, HPAmount, New Vector2(200, 256)))
|
||||||
Else
|
Else
|
||||||
|
|
|
@ -195,7 +195,7 @@
|
||||||
Else
|
Else
|
||||||
FadeEntity = Entity
|
FadeEntity = Entity
|
||||||
End If
|
End If
|
||||||
If startState = -1.0F Then startState = FadeEntity.Opacity
|
If startState = -1 Then startState = FadeEntity.NormalOpacity
|
||||||
Dim baEntityOpacity As BAEntityOpacity = New BAEntityOpacity(FadeEntity, RemoveEntityAfter, TransitionSpeed, FadeIn, EndState, startDelay, endDelay, startState)
|
Dim baEntityOpacity As BAEntityOpacity = New BAEntityOpacity(FadeEntity, RemoveEntityAfter, TransitionSpeed, FadeIn, EndState, startDelay, endDelay, startState)
|
||||||
AnimationSequence.Add(baEntityOpacity)
|
AnimationSequence.Add(baEntityOpacity)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue