Changes

Jump to navigation Jump to search
reorder sections to keep "custom *" sections together
Line 23: Line 23:  
# If SMAPI still says your mod is incompatible, check the <samp>TRACE</samp> messages in the log file for the reason why.<br />If the logs say "''marked 'assume broken' in SMAPI's internal compatibility list''", you can increase the <samp>Version</samp> in your content pack's <samp>manifest.json</samp> file to bypass it.
 
# If SMAPI still says your mod is incompatible, check the <samp>TRACE</samp> messages in the log file for the reason why.<br />If the logs say "''marked 'assume broken' in SMAPI's internal compatibility list''", you can increase the <samp>Version</samp> in your content pack's <samp>manifest.json</samp> file to bypass it.
 
# Test the mod in-game and make any other changes needed.
 
# Test the mod in-game and make any other changes needed.
 +
 +
==Buff overhaul==
 +
1.6 rewrites buffs to work more consistently and be more extensible:
 +
 +
* Buff logic is unified into <samp>Game1.player.buffs</samp>, which is the single source of truth for buff data. This replaces the previous <samp>player.added*</samp> and <samp>player.appliedBuffs</samp> fields, <samp>BuffsDisplay</samp> logic, enchantment stat bonuses, and boots/ring attribute changes on (un)equip.
 +
* This also removes limitations on buff types (e.g. buffs can add weapon bonuses and weapons can add attribute buffs) and buffable equipment (e.g. equipped tools can have buffs too).
 +
* Buff effects are now fully recalculated when they change, to fix a range of longstanding bugs like attribute drift and double-debuffs. Just like before, the buffs are managed locally; only the buff IDs and aggregate attribute effects are synced.
 +
 +
'''For C# mods:'''
 +
* Each buff now has a unique string ID. You can apply a new buff with the same ID to replace it (so you no longer need to manually find and remove previous instances of the buff).
 +
* You can add standard buff effects to any equipment by overriding <samp>Item.AddEquipmentEffects</samp>, or add custom behaviour/buffs by overriding <samp>Item.onEquip</samp> and <samp>Item.onUnequip</samp>.
 +
* You can add custom food or drink buffs by overriding <samp>Item.GetFoodOrDrinkBuffs()</samp>.
 +
* The <samp>Buff</samp> constructor now supports a custom icon texture, sprite index, display name, description, and millisecond duration to fully support custom buffs.
 +
* You can change how buff attributes are displayed (or add new attributes) by extending the <samp>BuffsDisplay.displayAttributes</samp> list.
 +
 +
For example, here's how to add a custom buff which adds +3 speed:
 +
 +
<syntaxhighlight lang="c#">
 +
Buff buff = new Buff(
 +
    buff_id: "Example.ModId/ZoomZoom",
 +
    display_name: "Zoom Zoom", // can optionally specify description text too
 +
    icon_texture: this.Helper.Content.Load<Texture2D>("assets/zoom.png"),
 +
    icon_sheet_index: 0,
 +
    duration: 30_000, // 30 seconds
 +
    buff_effects: new BuffEffects()
 +
    {
 +
        speed = { 10 } // shortcut for buff.speed.Value = 10
 +
    }
 +
);
 +
Game1.player.applyBuff(buff);
 +
</syntaxhighlight>
 +
 +
You can also implement your own custom effects in code by checking if the buff is active, like <code>Game1.player.hasBuff("Example.ModId/ZoomZoom")</code>.
    
==Custom items==
 
==Custom items==
Line 285: Line 318:  
</dl>
 
</dl>
   −
==Buff overhaul==
+
==Custom map areas==
1.6 rewrites buffs to work more consistently and be more extensible:
+
<span style="color: red;">'''TODO'''</span>
   −
* Buff logic is unified into <samp>Game1.player.buffs</samp>, which is the single source of truth for buff data. This replaces the previous <samp>player.added*</samp> and <samp>player.appliedBuffs</samp> fields, <samp>BuffsDisplay</samp> logic, enchantment stat bonuses, and boots/ring attribute changes on (un)equip.
+
==Custom shop entries==
* This also removes limitations on buff types (e.g. buffs can add weapon bonuses and weapons can add attribute buffs) and buffable equipment (e.g. equipped tools can have buffs too).
+
<span style="color: red;">'''TODO'''</span>
* Buff effects are now fully recalculated when they change, to fix a range of longstanding bugs like attribute drift and double-debuffs. Just like before, the buffs are managed locally; only the buff IDs and aggregate attribute effects are synced.
     −
'''For C# mods:'''
+
==Custom wild trees==
* Each buff now has a unique string ID. You can apply a new buff with the same ID to replace it (so you no longer need to manually find and remove previous instances of the buff).
+
<span style="color: red;">'''TODO'''</span>
* You can add standard buff effects to any equipment by overriding <samp>Item.AddEquipmentEffects</samp>, or add custom behaviour/buffs by overriding <samp>Item.onEquip</samp> and <samp>Item.onUnequip</samp>.
  −
* You can add custom food or drink buffs by overriding <samp>Item.GetFoodOrDrinkBuffs()</samp>.
  −
* The <samp>Buff</samp> constructor now supports a custom icon texture, sprite index, display name, description, and millisecond duration to fully support custom buffs.
  −
* You can change how buff attributes are displayed (or add new attributes) by extending the <samp>BuffsDisplay.displayAttributes</samp> list.
  −
 
  −
For example, here's how to add a custom buff which adds +3 speed:
  −
 
  −
<syntaxhighlight lang="c#">
  −
Buff buff = new Buff(
  −
    buff_id: "Example.ModId/ZoomZoom",
  −
    display_name: "Zoom Zoom", // can optionally specify description text too
  −
    icon_texture: this.Helper.Content.Load<Texture2D>("assets/zoom.png"),
  −
    icon_sheet_index: 0,
  −
    duration: 30_000, // 30 seconds
  −
    buff_effects: new BuffEffects()
  −
    {
  −
        speed = { 10 } // shortcut for buff.speed.Value = 10
  −
    }
  −
);
  −
Game1.player.applyBuff(buff);
  −
</syntaxhighlight>
  −
 
  −
You can also implement your own custom effects in code by checking if the buff is active, like <code>Game1.player.hasBuff("Example.ModId/ZoomZoom")</code>.
      
==Standardized data fields==
 
==Standardized data fields==
Line 348: Line 357:     
==String event IDs==
 
==String event IDs==
<span style="color: red;">'''TODO'''</span>
  −
  −
==Custom wild trees==
  −
<span style="color: red;">'''TODO'''</span>
  −
  −
==Custom map areas==
  −
<span style="color: red;">'''TODO'''</span>
  −
  −
==Custom shop entries==
   
<span style="color: red;">'''TODO'''</span>
 
<span style="color: red;">'''TODO'''</span>
  
translators
8,447

edits

Navigation menu