tModPorter icon indicating copy to clipboard operation
tModPorter copied to clipboard

NPC buff immunity porting

Open direwolf420 opened this issue 4 years ago • 0 comments

1.4 changed the way it declares buff immunity on npcs:

//Don't set immunities like this as of 1.4:
NPC.buffImmune[BuffID.Confused] = true;
immunities are handled via dictionaries through NPCID.Sets.DebuffImmunitySets

which looks like this, in SetStaticDefaults (!):

//Specify the debuffs it is immune to
NPCDebuffImmunityData debuffData = new NPCDebuffImmunityData {
	SpecificallyImmuneTo = new int[] {
		BuffID.Confused
	}
};
NPCID.Sets.DebuffImmunitySets.Add(Type, debuffData);

So it would be necessary to port such statements (most often found in SetDefaults), problematic would be dynamic immunities in AI() (haven't seen anyone do it), or looping through all buff IDs to set it, which I believe is just done through ImmuneToAllBuffsThatAreNotWhips = true now. Detecting this would be a pain I bet.

As an aside, Player.buffImmune is unchanged

direwolf420 avatar Jan 29 '21 17:01 direwolf420