I'm just guessing here, but you might be able to use Item->Class->Level to change the level of a sword if your HP is below a threshold. Something like:
Code:
item script PerilSword{
void run()
{
itemclass ic = this->Class;
if(Link->HP < (2*16)+1) // Link has 2 hearts or less
{
ic->Level = 4; // master sword
}
else
{
ic->Level = 1; // wooden sword
}
}
}
...but that probably won't actually change the power. I think you would need direct access to something like Item->Power, which isn't available yet.
Go ahead and play with it, though.