private static void UpdateCompound() { if (!Game1.hasLoadedGame) { return; } Game1.player.attackIncreaseModifier -= Compound.attackIncreaseModifier; Game1.player.knockbackModifier -= Compound.KnockbackModifier; Game1.player.critChanceModifier -= Compound.CritChanceModifier; Game1.player.critPowerModifier -= Compound.CritPowerModifier; Game1.player.weaponSpeedModifier -= Compound.WeaponSpeedModifier; Game1.player.weaponPrecisionModifier -= Compound.WeaponPrecisionModifier; Game1.player.magneticRadius -= Compound.MagnetRange; if (Compound.GlowDistance == 0) { Utility.removeLightSource(MyUnique); } SpeedState = 0; SavedSpeed = 0; Game1.player.addedSpeed = 0; Compound = new FarmerModifier(); foreach (FarmerModifier mod in Modifiers) { Compound.MagnetRange += mod.MagnetRange; Compound.GlowDistance = Math.Max(Compound.GlowDistance, mod.GlowDistance); Compound.StaminaRegenModifier += mod.StaminaRegenModifier; Compound.HealthRegenModifier += mod.HealthRegenModifier; Compound.WalkSpeedModifier += mod.WalkSpeedModifier; Compound.RunSpeedModifier += mod.RunSpeedModifier; Compound.attackIncreaseModifier += mod.attackIncreaseModifier; Compound.KnockbackModifier += mod.KnockbackModifier; Compound.CritChanceModifier += mod.CritChanceModifier; Compound.CritPowerModifier += mod.CritPowerModifier; Compound.WeaponSpeedModifier += mod.WeaponSpeedModifier; Compound.WeaponPrecisionModifier += mod.WeaponPrecisionModifier; Compound.ExperienceModifierCombat += mod.ExperienceModifierCombat; Compound.ExperienceModifierFarming += mod.ExperienceModifierFarming; Compound.ExperienceModifierFishing += mod.ExperienceModifierFishing; Compound.ExperienceModifierForaging += mod.ExperienceModifierForaging; Compound.ExperienceModifierMining += mod.ExperienceModifierMining; } Compound.ExperienceModifierCombat /= Modifiers.Count + 1; Compound.ExperienceModifierFarming /= Modifiers.Count + 1; Compound.ExperienceModifierFishing /= Modifiers.Count + 1; Compound.ExperienceModifierForaging /= Modifiers.Count + 1; Compound.ExperienceModifierCombat /= Modifiers.Count + 1; Game1.player.attackIncreaseModifier += Compound.attackIncreaseModifier; Game1.player.knockbackModifier += Compound.KnockbackModifier; Game1.player.critChanceModifier += Compound.CritChanceModifier; Game1.player.critPowerModifier += Compound.CritPowerModifier; Game1.player.weaponSpeedModifier += Compound.WeaponSpeedModifier; Game1.player.weaponPrecisionModifier += Compound.WeaponPrecisionModifier; Game1.player.magneticRadius += Compound.MagnetRange; if (Compound.GlowDistance > 0) { Game1.currentLightSources.Add(new LightSource(Game1.lantern, new Vector2(Game1.player.position.X + (Game1.tileSize / 3), Game1.player.position.Y + Game1.tileSize), Compound.GlowDistance, new Color(0, 30, 150), MyUnique)); } }
void IPlayerHelper.RemoveModifier(FarmerModifier modifier) { if (Modifiers.Contains(modifier)) { Modifiers.Remove(modifier); } UpdateCompound(); }
bool IPlayerHelper.HasModifier(FarmerModifier modifier) { return(Modifiers.Contains(modifier)); }
void IPlayerHelper.AddModifier(FarmerModifier modifier) { Modifiers.Add(modifier); UpdateCompound(); }