package flash
{
import flash.display.MovieClip;
import flash.geom.Point;
public dynamic class Main extends MovieClip
{
public var her:Object;
public var g:Object;
public var rotationCounter:Number = 0;
public var herMas:Boolean = false;
public function toggleMas():void
{
//Invert and check.
if (herMas = !herMas)
{
her.setLeftArmPosition(2);
g.changeLayer(her.leftArmContainer, g.backLayer);
her.leftArmIK.setEndRotationTarget(-170, [g.him.rightLeg]);
her.leftArmIK.newTarget(her.leftHandOnHim, g.him.rightLeg, true);
}
else
{
her.setLeftArmPosition(her.currentLeftArmPosition);
}
}
public function doMas(l):void
{
// If toggled off or paused, do nothing.
if (!herMas || g.gamePaused) return;
rotationCounter = calcMasSpeed();
// Move arm.
her.leftArmIK.newTarget(new Point(-70 + Math.cos(rotationCounter) * 10, 260 + Math.sin(rotationCounter) * 10), her.torso.back, true);
her.leftArmIK.setEndRotationTarget(45, [her.torso.back, her.torso]);
g.changeLayer(her.leftArmContainer, her, her.leftLegContainer);
}
public function calcMasSpeed():Number
{
// Keep the increment separate to allow for some trigger.
var inc = (int(her.torso.rotation + 12 > 0) * (her.torso.rotation + 12) / 60 + her.vigour / 2700)
* Math.abs(100 - int(her.passOutFactor / her.passOutMax)) / 100;
return (rotationCounter + inc) % 360;
}
public function initl(l):void
{
her = l.her;
g = l.g;
l.addEnterFramePersist(doMas);
l.registerFunction(toggleMas, 77);
l.unloadMod();
}
}
}