Skip to content
Snippets Groups Projects
Commit 24a1bfd2 authored by Robin Halseth Sandvik's avatar Robin Halseth Sandvik
Browse files

Added support for stun status effect.

parent bc266f3e
No related branches found
No related tags found
1 merge request!34Dodge
...@@ -471,6 +471,17 @@ namespace BigSock { ...@@ -471,6 +471,17 @@ namespace BigSock {
/*
Is the character stunned.
*/
public bool IsStunned => NextTimeNotStunned > DateTime.Now;
/*
Stores the next time the character can isn't stunned.
*/
public DateTime NextTimeNotStunned { get; private set; } = DateTime.Now;
/* /*
Is the character visible. Is the character visible.
...@@ -503,12 +514,48 @@ namespace BigSock { ...@@ -503,12 +514,48 @@ namespace BigSock {
switch(statusType) { switch(statusType) {
case StatusEffectType.Invincible: return AddIFrames(amount); case StatusEffectType.Invincible: return AddIFrames(amount);
case StatusEffectType.Invisible: return AddInvisibility(amount); case StatusEffectType.Invisible: return AddInvisibility(amount);
case StatusEffectType.Stun: return AddStun(amount);
default: return false; default: return false;
} }
} }
/*
Adds Stun for the character.
*/
public bool AddStun(TimeSpan amount) {
// Get when the status effect would expire.
var wouldExpire = DateTime.Now + IFrameDuration;
// Only if that's later than current.
if(wouldExpire > NextTimeNotStunned) {
// If character currently doesn't have the status effect.
if(NextTimeNotStunned < DateTime.Now) {
ApplyStun();
}
// Set new time.
NextTimeNotStunned = wouldExpire;
return true;
}
return false;
}
/*
Appies Stun to the character.
*/
private void ApplyStun() {
}
/*
Removes Stun for the character.
*/
private void RemoveStun() {
}
/* /*
Adds invisibility for the character. Adds invisibility for the character.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment