public void Remove(Item sourceItem, EffectChangeReason reason) { foreach (var effect in Effects) { effect.Remove(sourceItem, reason); } }
public void Restore(Farmer farmer, EffectChangeReason reason) { // restore active effects shirtObserver?.Restore(farmer, reason); pantsObserver?.Restore(farmer, reason); hatObserver?.Restore(farmer, reason); }
private void RevalidateConditions(Item sourceItem, EffectChangeReason reason) { if (Parameters.Season.IsActive()) { if (!isApplied) { if (SourceItem != null && (reason == EffectChangeReason.Reset || (reason == EffectChangeReason.DayStart && Game1.dayOfMonth == 1))) { Game1.addHUDMessage(new CustomHUDMessage($"The effect of {SourceItem} is now active", SourceItem, Color.White, TimeSpan.FromSeconds(5))); } isApplied = true; Parameters.Effect.Apply(sourceItem, reason); } } else { if (isApplied) { if (SourceItem != null && reason == EffectChangeReason.Reset) { Game1.addHUDMessage(new CustomHUDMessage($"The effect of {SourceItem} wore off", SourceItem, Color.White, TimeSpan.FromSeconds(5))); } isApplied = false; Parameters.Effect.Remove(sourceItem, reason); } } }
public override void Remove(Item sourceItem, EffectChangeReason reason) { EffectHelper.ModHelper.Events.GameLoop.UpdateTicking -= GameLoop_UpdateTicking; EffectHelper.Events.LocationChanged -= Events_LocationChanged; RemoveLightSource(Game1.currentLocation); }
public void Suspend(Farmer farmer, EffectChangeReason reason) { // remove active effects, so that value changes do not get saved shirtObserver?.Suspend(farmer, reason); pantsObserver?.Suspend(farmer, reason); hatObserver?.Suspend(farmer, reason); }
public override void Apply(Item sourceItem, EffectChangeReason reason) { currentSourceItem = sourceItem; EffectHelper.ModHelper.Events.GameLoop.UpdateTicked -= GameLoop_UpdateTicked; EffectHelper.ModHelper.Events.GameLoop.UpdateTicked += GameLoop_UpdateTicked; }
public void Apply(Item sourceItem, EffectChangeReason reason) { foreach (var effect in Effects) { effect.Apply(sourceItem, reason); } }
public override void Apply(Item sourceItem, EffectChangeReason reason) { SourceItem = sourceItem; RevalidateConditions(sourceItem, reason); EffectHelper.Events.LocationChanged -= Events_LocationChanged; EffectHelper.Events.LocationChanged += Events_LocationChanged; }
/// <summary> /// Re-apply the current effects (after having them suspended) /// </summary> /// <param name="farmer"></param> public void Restore(Farmer farmer, EffectChangeReason reason) { if (isSuspended) { Logger.Debug($"Restore {clothingName} effects"); isSuspended = false; currentEffect?.Apply(currentItem, reason); } }
/// <summary> /// Disable the currently active effect /// </summary> public void Suspend(Farmer farmer, EffectChangeReason reason) { if (!isSuspended) { Logger.Debug($"Suspend {clothingName} effects"); isSuspended = true; currentEffect?.Remove(currentItem, reason); } }
public override void Remove(Item sourceItem, EffectChangeReason reason) { EffectHelper.ModHelper.Events.GameLoop.UpdateTicked -= GameLoop_UpdateTicked; Buff buff = Game1.buffsDisplay.otherBuffs.FirstOrDefault(p => p.which == BuffId); if (buff != null) { Game1.buffsDisplay.removeOtherBuff(BuffId); } }
public override void Remove(Item sourceItem, EffectChangeReason reason) { if (isApplied) { isApplied = false; Parameters.Effect.Remove(sourceItem, reason); } EffectHelper.Events.LocationChanged -= Events_LocationChanged; SourceItem = null; }
public override void Remove(Item sourceItem, EffectChangeReason reason) { int newValue = GetMaxValue(Game1.player) - Parameters.Amount; if (GetCurrentValue(Game1.player) > newValue) { SetCurrentValue(Game1.player, newValue); } SetMaxValue(Game1.player, newValue); Logger.Debug($"Max{AttributeName} - {Parameters.Amount}"); }
public override void Apply(Item sourceItem, EffectChangeReason reason) { if (reason == EffectChangeReason.DayStart) { Logger.Debug("Grant MaxEnergy buff"); // create & give buff to player MaxStaminaBuff staminaBuff = new MaxStaminaBuff(Parameters.Amount, 360, sourceItem?.DisplayName ?? ""); Game1.buffsDisplay.addOtherBuff(staminaBuff); // Game1.addHUDMessage(new HUDMessage("You awake eager to get to work.")); } }
public override void Remove(Item sourceItem, EffectChangeReason reason) { if (isApplied) { isApplied = false; Parameters.Effect.Remove(sourceItem, reason); if (reason == EffectChangeReason.DayEnd && Game1.dayOfMonth == 28) { // end of season info Game1.addHUDMessage(new CustomHUDMessage($"The effect of {SourceItem} wore off", SourceItem, Color.White, TimeSpan.FromSeconds(5))); } } EffectHelper.Events.LocationChanged -= Events_LocationChanged; SourceItem = null; }
public override void Apply(Item sourceItem, EffectChangeReason reason) { int curr = GetCurrentValue(Game1.player); int max = GetMaxValue(Game1.player); if (curr == max) { // if attribute is full, keep it full SetMaxValue(Game1.player, max + Parameters.Amount); SetCurrentValue(Game1.player, curr + Parameters.Amount); } else { SetMaxValue(Game1.player, max + Parameters.Amount); } Logger.Debug($"Max{AttributeName} + {Parameters.Amount}"); }
public override void Remove(Item sourceItem, EffectChangeReason reason) { // nothing to do }
public override void Remove(Item sourceItem, EffectChangeReason reason) { // not needed }
public override void Remove(Item sourceItem, EffectChangeReason reason) { EffectHelper.ModHelper.Events.Display.MenuChanged -= Display_MenuChanged; }
public override void Remove(Item sourceItem, EffectChangeReason reason) { EffectHelper.ModHelper.Events.GameLoop.UpdateTicking -= GameLoop_UpdateTicking; }
public override void Apply(Item sourceItem, EffectChangeReason reason) { lastXp = null; EffectHelper.ModHelper.Events.GameLoop.UpdateTicking += GameLoop_UpdateTicking; }
public override void Apply(Item sourceItem, EffectChangeReason reason) { EffectHelper.ModHelper.Events.GameLoop.OneSecondUpdateTicked += GameLoop_OneSecondUpdateTicked; }
public void Apply(Item sourceItem, EffectChangeReason reason) { // -- }
public void Remove(Item sourceItem, EffectChangeReason reason) { // -- }
public override void Remove(Item sourceItem, EffectChangeReason reason) { EffectHelper.Events.InteractedWithNPC -= Events_InteractedWithNPC; }
public override void Remove(Item sourceItem, EffectChangeReason reason) { ChangeCurrentLevel(Game1.player, -Parameters.Amount); Logger.Debug($"{SkillName} - {Parameters.Amount}"); }