using addcomponent for buffs, using variable for class

I’m trying to build a tiny turn-based battle engine and I hit a roadblock adding ‘buffs’ to my characters. I have the buffs as children of a parent class called ‘Status’ and am trying to add them to my Character class as components. I had it working just fine once, but I tried to make the function adding the component more generic and now get the error

no appropriate version of ‘unityEngine.GameObject.AddComponent’ for the argument list (Status) was found

Adding the buff component - contained in and called by my parent skill class:

function addStatus(user: Character, buff: Status){
	var nStatus = user.gameObject.AddComponent(buff);
}

this is how I am calling the addStatus, inside a child skill ‘shield’:

	var buff: shielded;
	super.addStatus(user, buff); 

shielded is a child of the Status class. All of these classes are contained in different .js files.

This same code works when I put a specific ‘buff’ into the call = addComponent(shielded); So I assume I’m just using the function wrong or I have completely misjudged how to go about this problem.

If you need to know anything more specific to see what is going wrong, please let me know. Thank you,

You might better off making the argument to AddComponent() a string or using typeof(class). You could make an enum named Statuses and make it the second argument to addStatus(). Pseudocode:

enum Statuses
{
	Shielded,
	Regeneration
}
	…

function AddStatus(user : Character, type : Statuses)
{
	switch(type)
	{
	case Statuses.Shielded:
	user.AddComponent(Shielded);
		…
	}
}

If all the components are added directly to the character, the variable gameObject already refers to it. So you shouldn’t really need the “user” and “super” variables either. It could then be simplified just to AddStatus(type : Statuses).