示例#1
0
 public void Remove(Item sourceItem, EffectChangeReason reason)
 {
     foreach (var effect in Effects)
     {
         effect.Remove(sourceItem, reason);
     }
 }
示例#2
0
 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);
                }
            }
        }
示例#4
0
        public override void Remove(Item sourceItem, EffectChangeReason reason)
        {
            EffectHelper.ModHelper.Events.GameLoop.UpdateTicking -= GameLoop_UpdateTicking;
            EffectHelper.Events.LocationChanged -= Events_LocationChanged;

            RemoveLightSource(Game1.currentLocation);
        }
示例#5
0
 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);
 }
示例#6
0
        public override void Apply(Item sourceItem, EffectChangeReason reason)
        {
            currentSourceItem = sourceItem;

            EffectHelper.ModHelper.Events.GameLoop.UpdateTicked -= GameLoop_UpdateTicked;
            EffectHelper.ModHelper.Events.GameLoop.UpdateTicked += GameLoop_UpdateTicked;
        }
示例#7
0
 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;
        }
示例#9
0
 /// <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);
     }
 }
示例#10
0
 /// <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);
     }
 }
示例#11
0
        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;
        }
示例#13
0
        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;
        }
示例#16
0
        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
 }
示例#18
0
 public override void Remove(Item sourceItem, EffectChangeReason reason)
 {
     // not needed
 }
示例#19
0
 public override void Remove(Item sourceItem, EffectChangeReason reason)
 {
     EffectHelper.ModHelper.Events.Display.MenuChanged -= Display_MenuChanged;
 }
示例#20
0
 public override void Remove(Item sourceItem, EffectChangeReason reason)
 {
     EffectHelper.ModHelper.Events.GameLoop.UpdateTicking -= GameLoop_UpdateTicking;
 }
示例#21
0
 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;
 }
示例#23
0
 public void Apply(Item sourceItem, EffectChangeReason reason)
 {
     // --
 }
示例#24
0
 public void Remove(Item sourceItem, EffectChangeReason reason)
 {
     // --
 }
 public override void Remove(Item sourceItem, EffectChangeReason reason)
 {
     EffectHelper.Events.InteractedWithNPC -= Events_InteractedWithNPC;
 }
示例#26
0
        public override void Remove(Item sourceItem, EffectChangeReason reason)
        {
            ChangeCurrentLevel(Game1.player, -Parameters.Amount);

            Logger.Debug($"{SkillName} - {Parameters.Amount}");
        }