//Clears the cache to default values public void ClearCache() { CachedName = null; CachedMoves.Clear(); CachedPassive = null; CachedPicture = null; CachedHasUltimate = true; CachedHasPassive = true; CachedDead = false; CachedTotalHP = 500; CachedCurrentHP = 500; CachedTotalActions = 1; CachedActions = 1; IsPuppet = false; CanPassTurn = true; CachedDeathMessage = null; CachedEffects.Clear(); CachedMarkers.Clear(); }
//Caches all relevant data public void CacheAll() { CachedName = Name; CachedMoves.AddRange(Moves); CachedPassive = Passive; CachedPicture = Picture; CachedHasUltimate = HasUltimate; CachedHasPassive = HasPassive; CachedDead = Dead; CachedTotalHP = TotalHP; CachedCurrentHP = CurrentHP; CachedTotalActions = TotalActions; CachedActions = Actions; CachedIsPuppet = IsPuppet; CachedCanPassTurn = CanPassTurn; CachedDeathMessage = DeathMessage; CachedEffects.AddRange(Effects); CachedMarkers.AddRange(Markers); }
//Swaps current data with the cache public void SwapCache() { var tempName = Name; Name = CachedName; CachedName = tempName; List <BasicMove> tempMoves = new List <BasicMove>(); tempMoves.AddRange(Moves); Moves.Clear(); Moves.AddRange(CachedMoves); CachedMoves.Clear(); CachedMoves.AddRange(tempMoves); var tempPassive = Passive; Passive = CachedPassive; CachedPassive = tempPassive; var tempPicture = Picture; Picture = CachedPicture; CachedPicture = tempPicture; var tempDead = Dead; Dead = CachedDead; CachedDead = tempDead; var tempTotalHP = TotalHP; TotalHP = CachedTotalHP; CachedTotalHP = tempTotalHP; var tempCurrentHP = CurrentHP; CurrentHP = CachedCurrentHP; CachedCurrentHP = tempCurrentHP; var tempTotalActions = TotalActions; TotalActions = CachedTotalActions; CachedTotalActions = tempTotalActions; var tempActions = Actions; Actions = CachedActions; CachedActions = tempActions; var tempIsPuppet = IsPuppet; IsPuppet = CachedIsPuppet; CachedIsPuppet = tempIsPuppet; var tempCanPassTurn = CanPassTurn; CanPassTurn = CachedCanPassTurn; CachedCanPassTurn = tempCanPassTurn; var tempDeathMessage = DeathMessage; DeathMessage = CachedDeathMessage; CachedDeathMessage = tempDeathMessage; List <BuffDebuff> tempEffects = new List <BuffDebuff>(); tempEffects.AddRange(Effects); Effects.Clear(); Effects.AddRange(CachedEffects); CachedEffects.Clear(); CachedEffects.AddRange(tempEffects); List <Marker> tempMarkers = new List <Marker>(); tempMarkers.AddRange(Markers); Markers.Clear(); Markers.AddRange(CachedMarkers); CachedMarkers.Clear(); CachedMarkers.AddRange(tempMarkers); }