// Adds amount to the status effect. public override void ApplyStatusEffect(BattleManager.StatusEffectEnum status, int amount) { Debug.Log("Status effect applied: " + status.ToString() + " w/ power " + amount); if (statusEffects.ContainsKey(status)) { StatusEffectDataHolder x = statusEffects[status]; // we have the status effect. Add to it. x.EffectValue += amount; // If the value is <= 0, we need to remove it. if (x.EffectValue <= 0) { puim.RemoveStatusEffect(x); statusEffects.Remove(status); } } else { // We don't have the status effect. Add it. statusEffects.Add(status, puim.AddNewStatusEffect(status, amount)); } if (statusEffects.TryGetValue(status, out var val)) { Debug.Log("We now have " + val.EffectValue + " power"); } }
/// <summary> /// Applies a status effect to the entity on the specified tile. /// </summary> /// <param name="target">A Vector2Int specifying which tile to target</param> /// <param name="status">Enum located in BattleManager that corresponds to which status effect you want to apply</param> /// <param name="power">How much status to apply</param> /// <returns>True if there was something on this tile.</returns> public bool ApplyStatusEffectOnTile(Vector2Int target, BattleManager.StatusEffectEnum status, int power) { Debug.Log("Applying status effect " + status.ToString() + " on tile " + target + ", with power " + power); Roguelike.Tile targetTile = map[target.x, target.y]; TileCreature tarCreature = targetTile.GetEntityOnTile() as TileCreature; if (tarCreature != null) { tarCreature.ApplyStatusEffect(status, power); return(true); } return(false); }