// Use this for initialization void Start() { if (spellCast == null) { spellCast = GameObject.FindGameObjectWithTag("PlayerController").GetComponent <SpellCast>(); } firstTeamIsActive = true; playerPositionInTeam = 0; activePlayer = teamA[0]; if (!sEffects) { sEffects = gameObject.GetComponent <StatusEffects>(); } if (!tManager) { tManager = gameObject.GetComponent <TurnManager>(); } if (teamA == null || teamB == null) { Debug.LogWarning("One of the teams is null!"); } else if (charactersPerTeam != teamA.Count || charactersPerTeam != teamB.Count) { Debug.LogWarning("Check team sizes!"); } }
private static void ApplyEffect(Actor actor, StatusEffects statusEffect, long durationMs, bool verbose) { if (!(actor.StatusEffects.ContainsKey(statusEffect))) { if (verbose) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine($"{statusEffect} applied!"); } actor.StatusEffects.Add(statusEffect, durationMs); } else { if (verbose) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine($"{statusEffect} refreshed!"); if (statusEffect == StatusEffects.Huton) { Console.WriteLine($"Current Huton Duration: { durationMs } milliseconds."); } } actor.StatusEffects[statusEffect] = durationMs; } }
public bool HandleEffects(StatusEffects statusEffect) { for(int i = affectedStatusEffects.Count-1; i >= 0; i--) { if(statusEffect.GetType() == affectedStatusEffects[i].GetType()) { int result = statusEffect.compare(affectedStatusEffects[i]); if (result == -2) //not even same elemental type continue; else if (result == -1) //weaker so give up { return false; } else if (result == 0) // equal so just refresh { affectedStatusEffects[i].refresh(); return false; } else //stronger so replate { affectedStatusEffects.Add(statusEffect); affectedStatusEffects.Remove(affectedStatusEffects[i]); return true; } } } affectedStatusEffects.Add(statusEffect); return true; }
public override void AssignStatusEffectsOnCombatStart() { StatusEffects.Add(new AppalledStatusEffect { Stacks = 1 }); }
public void RemoveStatusEffect(StatusEffect effect) { if (IsDead) { return; } foreach (var behaviour in effect.data.behaviour) { if (effect.tickTime == StatusEffect.TickTime.TurnStart) { OnStartTurn -= behaviour.TickPerTurn; } else { OnEndTurn -= behaviour.TickPerTurn; } OnAttackedBehaviour -= behaviour.OnAttacked; behaviour.OnUnafflicted(this); } DamageNumberCanvas canv = GameObject.Instantiate(FindObjectOfType <CombatManager>().damageNumberCanvasPrefab).GetComponent <DamageNumberCanvas>(); canv.Display("Expired: " + effect.data.name, Color.red); canv.transform.position = transform.position; StatusEffects.Remove(effect); RefreshUI(); }
public static void StatusEffects_GiveSpecialAbility(StatusEffects __instance) { if (GameController.gameController.levelType == "HomeBase" && !__instance.agent.isDummy && __instance.agent.agentName != VanillaAgents.MechEmpty) { return; } CustomAbility custom = __instance.agent.GetAbility(); if (custom is null) { return; } if (RogueFramework.IsDebugEnabled(DebugFlags.Abilities)) { RogueFramework.LogDebug($"Giving ability {custom} ({__instance.agent.specialAbility}, {__instance.agent.agentName})."); } try { custom.OnAdded(); } catch (Exception e) { RogueFramework.LogError(e, "CustomAbility.OnAdded", custom, __instance.agent); } if (custom is IAbilityTargetable) { __instance.SpecialAbilityInterfaceCheck(); } if (custom is IAbilityRechargeable) { __instance.RechargeSpecialAbility(custom.ItemInfo.Name); } }
public override void AssignStatusEffectsOnCombatStart() { StatusEffects.Add(new BlackBishopStatusEffect() { Stacks = 2 }); }
public void LoadStatusEffects() { foreach (StatusEffectData data in StatusEffectData) { StatusEffects.Add(BattleManager.Instance.GenerateStatusEffect(data)); } }
public static void StatusEffects_PressedSpecialAbility(StatusEffects __instance) { CustomAbility custom = __instance.agent.GetAbility(); if (custom is null) { return; } if (custom.Item.invItemName != __instance.agent.specialAbility) { return; } if (RogueFramework.IsDebugEnabled(DebugFlags.Abilities)) { RogueFramework.LogDebug($"Pressing ability ability {custom} ({__instance.agent.specialAbility}, {__instance.agent.agentName})."); } try { custom.OnPressed(); } catch (Exception e) { RogueFramework.LogError(e, "CustomAbility.OnPressed", custom, __instance.agent); } if (custom.Count > 0) { __instance.agent.inventory.buffDisplay.specialAbilitySlot.MakeNotUsable(); } }
public void ApplyStatusEffect(DD4EStatusEffect newStatusEffect) { // Extend the duration of Status Effect with similar effect if (StatusEffects.Exists(s => s.IsSameEffect(newStatusEffect))) { var newDamageEffect = (newStatusEffect as DD4EDamageModifier); if (newDamageEffect != null) { var index = StatusEffects.IndexOf(StatusEffects.Find(s => s.IsSameEffect(newStatusEffect))); if (newDamageEffect.DamageAmount > (StatusEffects[index] as DD4EDamageModifier).DamageAmount) { StatusEffects[index] = newStatusEffect; } } else { var index = StatusEffects.IndexOf(StatusEffects.Find(s => s.IsSameEffect(newStatusEffect))); StatusEffects[index].Duration = newStatusEffect.Duration; } } else { StatusEffects.Add(newStatusEffect); } OnPropertyChanged("StatusEffects"); }
// Changes movement speed back to normal after a certain time. Timer resets when hit by another projectile. private IEnumerator RegainSpeed() { StatusEffects icon = transform.GetChild(0).GetComponent <StatusEffects>(); Debug.Log(gameObject.tag); icon.StartEffect("Wet"); float alternatingTime = 0.5f; GetComponent <SpriteRenderer>().color = Color.blue; for (int i = 0; i < 3; i++) { yield return(new WaitForSeconds(alternatingTime)); GetComponent <SpriteRenderer>().color = Color.white; yield return(new WaitForSeconds(alternatingTime)); GetComponent <SpriteRenderer>().color = Color.blue; } GetComponent <SpriteRenderer>().color = Color.white; icon.StopEffects(); appliedReductionEffects -= 1; if (appliedReductionEffects == 0) { activeMoveSpeed = PlayerData2.maxMoveSpeed; } if (appliedReductionEffects < 0) { Debug.Log("Error: applied speed effects less than 0"); } }
public static void SetupTraitHook(Trait trait, StatusEffects parent) { bool debug = RogueFramework.IsDebugEnabled(DebugFlags.Traits); bool updateable = false; trait.__RogueLibsContainer = parent; foreach (IHookFactory <Trait> factory in RogueFramework.TraitFactories) { if (factory.TryCreate(trait, out IHook <Trait> hook)) { if (debug) { if (hook is CustomTrait) { RogueFramework.LogDebug($"Initializing custom trait {hook} ({trait.traitName}, {parent.agent.agentName})."); } else { RogueFramework.LogDebug($"Initializing trait hook {hook} ({trait.traitName}, {parent.agent.agentName})."); } } trait.AddHook(hook); if (hook is CustomTrait && hook is ITraitUpdateable) { updateable = true; } } } if (updateable && parent.agent.name != "DummyAgent" && !parent.agent.name.Contains("Backup")) { parent.StartCoroutine(parent.UpdateTrait(trait)); trait.requiresUpdates = true; } }
public IEnumerator Trapped(GameObject trap, float trapTime) { float alternatingTime = trapTime / 6; StatusEffects statusIcon = transform.GetChild(0).GetComponent <StatusEffects>(); statusIcon.StartEffect("Bear Trap"); if (hasAuthority) { Debug.Log("Disabled"); PlayerData2.playerClick.enabled = false; PlayerData2.playerShoot.canShoot = false; } activeMoveSpeed = 0.0f; for (int i = 0; i < 3; i++) { yield return(new WaitForSeconds(alternatingTime)); GetComponent <SpriteRenderer>().color = Color.white; yield return(new WaitForSeconds(alternatingTime)); GetComponent <SpriteRenderer>().color = Color.red; } GetComponent <SpriteRenderer>().color = Color.white; if (hasAuthority) { Debug.Log("Enabled"); PlayerData2.playerClick.enabled = true; PlayerData2.playerShoot.canShoot = true; } statusIcon.StopEffects(); activeMoveSpeed = PlayerData2.maxMoveSpeed; Destroy(trap); }
private void Update() { status = this; //Creates a new instance of the status. if (!Application.isPlaying && m_statusEffects == null) { m_statusEffects = new List <Status>(); m_statusEffects.Add(new Status()); } for (int i = 0; i < m_statusEffects.Count; i++) { //Checks if the stats are less than 0, if so, create a new stat. if (m_statusEffects[i].allStatsEffected.Count <= 0) { AddNewStats(i); } //If a change has occured in this script of that the stats index is //different in length to the nested list of strings, readjust the list. if (hasBeenChanged == true || m_statusEffects[i].allStatsEffected.Count != m_statusEffects[i].m_statIndexPos.Count) { ReadjustList(i); } } }
public void EndTurn() { // Regenerate Health foreach (DD4EStatusEffect status in StatusEffects.FindAll(s => s.Type == DD4EStatusEffectType.Regeneration)) { var damageStatus = (status as DD4EDamageModifier); if (damageStatus != null) { Heal(damageStatus.DamageAmount); } } // End Effects StatusEffects.RemoveAll(s => s.Duration == DD4EStatusEffectDuration.EndOfMyTurn); for (int i = 0; i < StatusEffects.Count; i++) { if (StatusEffects[i].Duration == DD4EStatusEffectDuration.EndOfMyNextTurn) { StatusEffects[i].Duration = DD4EStatusEffectDuration.EndOfMyTurn; } if (StatusEffects[i].Duration == DD4EStatusEffectDuration.EndOfMyNextTurnSustain) { StatusEffects[i].Duration = DD4EStatusEffectDuration.EndOfMyTurnSustain; } } OnPropertyChanged("StatusEffects"); }
public static void SetupEffectHook(StatusEffect effect, StatusEffects parent) { bool debug = RogueFramework.IsDebugEnabled(DebugFlags.Effects); effect.__RogueLibsContainer = parent; foreach (IHookFactory <StatusEffect> factory in RogueFramework.EffectFactories) { if (factory.TryCreate(effect, out IHook <StatusEffect> hook)) { if (debug) { if (hook is CustomEffect) { RogueFramework.LogDebug($"Initializing custom effect {hook} ({effect.statusEffectName}, {parent.agent.agentName})."); } else { RogueFramework.LogDebug($"Initializing effect hook {hook} ({effect.statusEffectName}, {parent.agent.agentName})."); } } effect.AddHook(hook); // CustomEffect does not call OnAdded when initialized, // because of the GetStatusEffectTime/Hate patches if (hook is CustomEffect custom) { custom.OnAdded(); } } } }
public void StartBattle() { statModifiers.Clear(); StatusEffects.Clear(); calculateStatsFromModifiers(); BattleEntity = new Entity(ResourceManager.GetNewSkeleton(Data.BattleSkeletonName), new Vector2()); BattleEntity.Skeleton.SetSkin(Data.BattleSkeletonSkinName); BattleEntity.Scale = new Vector2(0.6f); BattleEntity.Altitude = Data.BattleAltitude; if (Data.BattleShadowFollowBoneName != null && Data.BattleShadowFollowBoneName.Length > 0) { BattleEntity.ShadowFollowBone = BattleEntity.Skeleton.FindBone(Data.BattleShadowFollowBoneName); } updateBattleEntitySkeleton(); HurtThisTurn = false; hasIdleWeaponAnimation = BattleEntity.Skeleton.Data.FindAnimation("idle_weapon") != null; hasIdleShieldAnimation = BattleEntity.Skeleton.Data.FindAnimation("idle_shield") != null; hasHurtWeaponAnimation = BattleEntity.Skeleton.Data.FindAnimation("hurt_weapon") != null; hasHurtShieldAnimation = BattleEntity.Skeleton.Data.FindAnimation("hurt_shield") != null; BattleEntity.AnimationState.SetAnimation(GetBattleEntityIdleAnimationName(), true); BattleEntity.AnimationState.Time = (float)Game1.Random.NextDouble(); }
IEnumerator Unapply(StatusEffects target) { yield return(new WaitForSeconds(duration)); switch (type) { case EffectsType.Slow: target.ResetSpeed(); break; case EffectsType.Stun: Debug.Log("reseting stun"); target.Unstun(); break; case EffectsType.PhysicalAttack: target.ResetPhysDmg(); break; case EffectsType.MagicalAttack: target.ResetMagDmg(); break; default: break; } }
public double Attack(StrikingDummy target, WeaponSkills weaponSkill) { var animationLocked = QueuedEffects.ContainsKey(Skills.StatusEffects.AnimationLocked); if (GcdDuration > 0 || animationLocked) { return(0); } var potency = WeaponLibrary.WeaponPotencies(weaponSkill, LastSkills); var damage = FormulaLibrary.WeaponSkills(potency, Weapon.WeaponDamage, GetDexterity(), Det, CalculateMultiplier(target, DamageType.Slashing)); if (StatusEffects.ContainsKey(Skills.StatusEffects.Duality)) { damage *= 2; StatusEffects.Remove(Skills.StatusEffects.Duality); } else { damage = (damage * CalculateCritChance() * FormulaLibrary.CritDmg(Crt)) + (damage * (1 - CalculateCritChance())); } WeaponLibrary.QueueEffect(this, target, weaponSkill); var gcdMultiplier = StatusEffects.ContainsKey(Skills.StatusEffects.Huton) ? 0.85 : 1.00; GcdDuration = (int)TimeSpan.FromSeconds(FormulaLibrary.Gcd(Sks, gcdMultiplier)).TotalMilliseconds; LastSkills.Push(weaponSkill); return(damage); }
public virtual bool UseItem(string itemName) { var foundItem = Items.FirstOrDefault(i => i.Name.ToLower() == itemName.ToLower()); if (foundItem != null) { if (foundItem is Consumable) { var foundConsumable = (Consumable)foundItem; Console.WriteLine($"{Name} used the {foundConsumable.Name}."); foreach (var statusEffect in foundConsumable.StatusEffects) { StatusEffects.Add(statusEffect); ApplyStatusEffect(statusEffect); } Items.Remove(foundItem); return(true); } else { Console.WriteLine($"{foundItem.Name} is not consumable."); } } else { Console.WriteLine($"{Name} does not have currently have {itemName.IndefiniteArticle().ToLower()} {itemName}."); } return(false); }
public void Apply(StatusEffects target) { switch (type) { case EffectsType.Slow: target.Slow(value); break; case EffectsType.Stun: // Debug.Log("stunning"); target.Stun(); break; case EffectsType.PhysicalAttack: target.ChangePhysicalDamage(value, duration); break; case EffectsType.MagicalAttack: target.ChangeMagDmg(value, duration); break; default: break; } if (target.isActiveAndEnabled) { target.StartCoroutine(Unapply(target)); } }
public WeaponInfo() { foreach (StatusEffectData data in StatusEffectData) { StatusEffects.Add(BattleManager.Instance.GenerateStatusEffect(data)); } }
public void GiveStatusEffect(float amount, float strength, StatusEffects effectType) { switch (effectType) { case StatusEffects.Poison: poisoned = Math.Max(Mathf.RoundToInt(amount + 0.5f), poisoned); if (poisoned != 0) { poisonStrength = Math.Max(strength, poisonStrength); } else { poisonStrength = strength; } break; case StatusEffects.Burning: burning = Math.Max(Mathf.RoundToInt(amount + 0.5f), burning); if (burning != 0) { burningStrength = Math.Max(strength, burningStrength); } else { burningStrength = strength; } break; } }
public MonsterStatusEffect UpdateAndGetStatusEffect(ulong address, int index, float maxBuildup, float currentBuildup, float maxDuration, float currentDuration, int timesActivatedCount) { MonsterStatusEffect statusEffect = StatusEffects.SingleOrDefault(collectionStatusEffect => collectionStatusEffect.Index == index); // TODO: check address??? if (statusEffect != null) { //statusEffect.Address = Address; statusEffect.Duration.Max = maxDuration; statusEffect.Duration.Current = currentDuration; statusEffect.Buildup.Max = maxBuildup; statusEffect.Buildup.Current = currentBuildup; statusEffect.TimesActivatedCount = timesActivatedCount; } else { statusEffect = new MonsterStatusEffect(this, address, index, maxBuildup, currentBuildup, maxDuration, currentDuration, timesActivatedCount); statusEffect.Changed += PartOrStatusEffect_Changed; StatusEffects.Add(statusEffect); } statusEffect.NotifyPropertyChanged(nameof(MonsterStatusEffect.IsVisible)); return(statusEffect); }
// Start is called before the first frame update void Start() { cam = Camera.main; status = GameObject.Find("Player").GetComponent <StatusEffects>(); //Save the renderer's for various objects. sheetsMade = GameObject.Find("Bed Blanket - Made").GetComponent <Renderer>(); sheetsMade.enabled = false; sheetsUnmade = GameObject.Find("Bed Blanket - Unmade").GetComponent <Renderer>(); sheetsUnmade.enabled = true; pillowMade = GameObject.Find("Bed Pillow - Made").GetComponent <Renderer>(); pillowMade.enabled = false; pillowUnmade = GameObject.Find("Bed Pillow - Unmade").GetComponent <Renderer>(); pillowUnmade.enabled = true; keys = GameObject.Find("Keys").GetComponentInChildren <Renderer>(); wallet = GameObject.Find("Wallet").GetComponentInChildren <Renderer>(); phone = GameObject.Find("Phone").GetComponentInChildren <Renderer>(); keysIcon = GameObject.Find("Keys Icon"); keysIcon.SetActive(false); walletIcon = GameObject.Find("Wallet Icon"); walletIcon.SetActive(false); bedIcon = GameObject.Find("Bed Icon"); bedIcon.SetActive(false); soapIcon = GameObject.Find("Soap Icon"); soapIcon.SetActive(false); toothbrushIcon = GameObject.Find("Toothbrush Icon"); toothbrushIcon.SetActive(false); hamburgerIcon = GameObject.Find("Hamburger Icon"); hamburgerIcon.SetActive(false); text = GameObject.Find("Text Box").GetComponent <Text>(); text.text = "Another day ... maybe this time I'll make it outside the house."; }
public override void AssignStatusEffectsOnCombatStart() { StatusEffects.Add(new EruditionStatusEffect { Stacks = 10 }); }
public void Initialize(uint difficulty) { currentDate = new System.DateTime(startYear, startMonth, 1); progress = 0.0f; goalCell = Grid.grid.GetRandomCellID(1, 1); workPlan = new WorkPlan(); finances = new Finances(); simParam = new SimulationParameters(difficulty); statEffects = new StatusEffects(); onNewDay = null; // dayEvents = new List<ScenarioEvent>(); // nightEvents = new List<ScenarioEvent>(); StopAllCoroutines(); workingAnimation = null; workingProcess = null; nightProcess = null; nightAnimation = null; helperCounter = 0; helperCounter2 = 0; workPlan.SetExcavationArea(Grid.grid.GetRandomCellID(), ControlManager.minVizFieldRadius); }
public void FinishBattle() { statModifiers.Clear(); StatusEffects.Clear(); BattleEntity = null; HurtThisTurn = false; }
private void OnTriggerEnter(Collider col) { if (Shooter && col) { colInfo = col.GetComponent <Info>(); if (colInfo && colInfo.team != Shooter.GetComponent <Info>().team) { StatusEffects.Inflict(col.gameObject, effect); tmpStack = StatusEffectsManager.Instance.GetStacks(col.gameObject.GetInstanceID(). ToString(), effect.m_name); if (0 < tmpStack) { colInfo.TakeDamage(damage * (2 * tmpStack + 1)); } else { colInfo.TakeDamage(damage); } if (!HitMultiTarget) { Destroy(gameObject); } } } }
public void ServerAdd(StatusEffect effect, Health inflicter) { effect.Inflicter = inflicter; if (effect.IsInstant) { effect.OnList = this; effect.OnPickup(); effect.OnDrop(); RpcInstantStatusEffect(effect); return; } // Iterate over each effect to see if an effect of the same type is already in the list. for (int i = 0; i < StatusEffects.Count; i++) { if (StatusEffects[i].GetType() == effect.GetType()) { StatusEffects[i].OnEffectAlreadyInList(effect); RpcOnEffectAlreadyInList(i, effect); return; } } StatusEffects.Add(effect); coroutineForEffect.Add(effect, new ExtendedCoroutine(this, DoTick(effect), null, true)); }
public void Clear() { while (StatusEffects.Count > 0) { StatusEffects.RemoveAt(0); } }
public int compare(StatusEffects statusEffects) { Rooted comparing = (Rooted)statusEffects; if (typeOfRoot == comparing.typeOfRoot) return -2; float durationOfStatus = duration; float durationOfComparing = comparing.duration; if (durationOfStatus == durationOfComparing) return 0; else if (durationOfStatus < durationOfComparing) return -1; else return 1; }
public int compare(StatusEffects statusEffects) { DamageOverTime comparing = (DamageOverTime)statusEffects; if (typeOfDamage != comparing.typeOfDamage) return -2; float damageOfStatus = damage * (duration / hitsPerSecond); float damageOfComparing = comparing.damage * (comparing.duration / comparing.hitsPerSecond); if (damageOfStatus == damageOfComparing) return 0; else if (damageOfStatus < damageOfComparing) return -1; else return 1; }
public int compare(StatusEffects statusEffects) { Slow comparing = (Slow)statusEffects; if (typeOfSlow == comparing.typeOfSlow) return -2; float slowOfStatus = slow /duration; float slowOfComparing = slow / duration; if (slowOfStatus == slowOfComparing) return 0; else if (slowOfStatus < slowOfComparing) return -1; else return 1; }
public int compare(StatusEffects statusEffects) { Stun comparing = (Stun)statusEffects; if (typeOfStun == comparing.typeOfStun) return -2; float durationOfStatus = duration; float durationOfComparing = comparing.duration; if (durationOfStatus == durationOfComparing) return 0; else if (durationOfStatus < durationOfComparing) return -1; else return 1; }
static void UpdateStatsReplacement(Character[] c, ParticleManager pMan, StatusEffects sType, int i, int pOwner, float finalHitValue, float recharge) { OrigUpdateStats(c, pMan, sType, i, pOwner, finalHitValue, recharge); if (i == 0) { // finalHitValue gets adjusted in numerous places in the original code, and I'm too lazy and don't want to reimplement that code, // so I will assume if you only have 1 HP you would have been dead anyway. It's not your lucky day. // while loop just in case UpdateStats() adjusts the hit to be > 1 (or < 1, which casts to 0) and nullify it. while (c[i].HP == 1) { OrigUpdateStats(c, pMan, sType, i, pOwner, 1f, recharge); } } }
private static void ApplyEffect(Actor actor, StatusEffects statusEffect, long durationSeconds) { if (!(actor.StatusEffects.ContainsKey(statusEffect))) { actor.StatusEffects.Add(statusEffect, (long)TimeSpan.FromSeconds(durationSeconds).TotalMilliseconds); } else { actor.StatusEffects[statusEffect] = (long)TimeSpan.FromSeconds(durationSeconds).TotalMilliseconds; } }
private static void ApplyDamageOverTime(Actor target, StatusEffects statusEffect, EffectSnapshot effectSnapshot, bool verbose) { if (!(target.DamageOverTimeEffects.ContainsKey(statusEffect))) { if (verbose) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine($"{statusEffect} applied!"); } target.DamageOverTimeEffects.Add(statusEffect, effectSnapshot); } else { if (verbose) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine($"{statusEffect} refreshed!"); } target.DamageOverTimeEffects[statusEffect] = effectSnapshot; } }
static void OrigUpdateStats(Character[] c, ParticleManager pMan, StatusEffects sType, int i, int pOwner, float finalHitValue, float recharge) { // Stub to be replaced with original HitManager.UpdateStats() method. }
private static void ApplyEffect(Actor actor, StatusEffects statusEffect, long durationMs, bool verbose) { if (!(actor.StatusEffects.ContainsKey(statusEffect))) { if (verbose) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine($"{statusEffect} applied!"); } actor.StatusEffects.Add(statusEffect, durationMs); } else { if (verbose) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine($"{statusEffect} refreshed!"); if (statusEffect == StatusEffects.Huton) { Console.WriteLine($"Current Huton Duration: { durationMs } milliseconds."); } } actor.StatusEffects[statusEffect] = durationMs; } }
/// <summary> /// Adds the status effect onto the character /// </summary> /// <param name="effect">Specified status effect to add</param> public void AddStatusEffect(StatusEffects effect) { status |= effect; }
/// <summary> /// A helper method that updates or starts the Flash coroutine. /// </summary> /// <param name="enemyState">The coroutine to update</param> /// <param name="duration">The duration of the coroutine</param> private void StartOrUpdateCoroutine(StatusEffects enemyState, float duration) { if (!this.activeStatusFlashCoroutineEndTimes.ContainsKey(enemyState) || this.activeStatusFlashCoroutineEndTimes[enemyState] < Time.time) { this.activeStatusFlashCoroutineEndTimes[enemyState] = Time.time + duration; return; } this.activeStatusFlashCoroutineEndTimes[enemyState] = Time.time + duration; }
/// <summary> /// Damages the enemy over time. /// Updates a coroutine that flashes a color over the <see cref="EnemyBase"/> sprite. /// </summary> /// <param name="damage">The total damage.</param> /// <param name="duration">Duration of effect.</param> /// <param name="interval">The interval to inflict damage.</param> /// <param name="status">The status of the enemy.</param> public void DamageOverTime(int damage, float duration, float interval, StatusEffects status) { if (status == StatusEffects.Poison) { IBuff buff = new DamageOverTime(this, duration, damage, interval); this.debuffs.Add(buff); this.StartOrUpdateCoroutine(status, duration); } else if (status == StatusEffects.Burn) { IBuff buff = new DamageOverTime(this, duration, damage, interval); this.debuffs.Add(buff); this.StartOrUpdateCoroutine(status, duration); } }
/// <summary> /// Removes a status effect from the character /// </summary> /// <param name="effect">Specified status effect to remove</param> public void RemoveStatusEffect(StatusEffects effect) { status &= ~effect; }
public bool applyStatusEffect(StatusEffects statusEffect) { return HandleEffects(statusEffect); }
private static void ApplyEffect(Actor actor, StatusEffects statusEffect, long durationSeconds, bool verbose) { if (!(actor.StatusEffects.ContainsKey(statusEffect))) { if (verbose) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine($"{statusEffect} applied!"); } actor.StatusEffects.Add(statusEffect, (long)TimeSpan.FromSeconds(durationSeconds).TotalMilliseconds); } else { if (verbose) { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine($"{statusEffect} refreshed!"); } actor.StatusEffects[statusEffect] = (long)TimeSpan.FromSeconds(durationSeconds).TotalMilliseconds; } }
private static void ApplyEffect(Actor actor, StatusEffects statusEffect, long durationSeconds) { if (!(actor.StatusEffects.ContainsKey(statusEffect))) { actor.StatusEffects.Add(statusEffect, (long)TimeSpan.FromSeconds(durationSeconds).TotalMilliseconds); } else { if (statusEffect == StatusEffects.BloodOfTheDragon && actor.StatusEffects[statusEffect] > (long) TimeSpan.FromSeconds(durationSeconds).TotalMilliseconds) { return; } actor.StatusEffects[statusEffect] = (long)TimeSpan.FromSeconds(durationSeconds).TotalMilliseconds; } }
public void unapplyStatusEffect(StatusEffects statusEffect) { affectedStatusEffects.Remove(statusEffect); }