Skip to content

Commit

Permalink
Make spell cast frame render for slightly longer
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed Apr 18, 2022
1 parent 59d635b commit b48ed13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions EOLib/Domain/Character/CharacterRenderProperties.cs
Expand Up @@ -31,6 +31,7 @@ public class CharacterRenderProperties : ICharacterRenderProperties
public int ActualAttackFrame { get; private set; }
public int RenderAttackFrame { get; private set; }
public int EmoteFrame { get; private set; }
public int ActualSpellCastFrame { get; private set; }

public SitState SitState { get; private set; }
public Emote Emote { get; private set; }
Expand Down Expand Up @@ -179,10 +180,10 @@ public ICharacterRenderProperties WithNextEmoteFrame()

public ICharacterRenderProperties WithNextSpellCastFrame()
{
// spell cast frame ticks: 0 0 1 1 1
var props = MakeCopy(this);
props.CurrentAction = props.CurrentAction == CharacterActionState.Standing
? CharacterActionState.SpellCast
: CharacterActionState.Standing;
props.ActualSpellCastFrame = (props.ActualSpellCastFrame + 1) % MAX_NUMBER_OF_ATTACK_FRAMES;
props.CurrentAction = props.ActualSpellCastFrame == 0 ? CharacterActionState.Standing : CharacterActionState.SpellCast;
return props;
}

Expand Down Expand Up @@ -271,6 +272,7 @@ private static CharacterRenderProperties MakeCopy(ICharacterRenderProperties oth
ActualAttackFrame = other.ActualAttackFrame,
RenderAttackFrame = other.RenderAttackFrame,
EmoteFrame = other.EmoteFrame,
ActualSpellCastFrame = other.ActualSpellCastFrame,

SitState = other.SitState,
Emote = other.Emote,
Expand Down Expand Up @@ -304,6 +306,7 @@ public override bool Equals(object obj)
RenderWalkFrame == properties.RenderWalkFrame &&
RenderAttackFrame == properties.RenderAttackFrame &&
EmoteFrame == properties.EmoteFrame &&
ActualSpellCastFrame == properties.ActualSpellCastFrame &&
SitState == properties.SitState &&
Emote == properties.Emote &&
IsHidden == properties.IsHidden &&
Expand Down Expand Up @@ -333,6 +336,7 @@ public override int GetHashCode()
hashCode = hashCode * -1521134295 + ActualAttackFrame.GetHashCode();
hashCode = hashCode * -1521134295 + RenderAttackFrame.GetHashCode();
hashCode = hashCode * -1521134295 + EmoteFrame.GetHashCode();
hashCode = hashCode * -1521134295 + ActualSpellCastFrame.GetHashCode();
hashCode = hashCode * -1521134295 + SitState.GetHashCode();
hashCode = hashCode * -1521134295 + Emote.GetHashCode();
hashCode = hashCode * -1521134295 + IsHidden.GetHashCode();
Expand Down
1 change: 1 addition & 0 deletions EOLib/Domain/Character/ICharacterRenderProperties.cs
Expand Up @@ -27,6 +27,7 @@ public interface ICharacterRenderProperties : ICloneable
int ActualAttackFrame { get; }
int RenderAttackFrame { get; }
int EmoteFrame { get; }
int ActualSpellCastFrame { get; }

SitState SitState { get; }
Emote Emote { get; }
Expand Down

0 comments on commit b48ed13

Please sign in to comment.