package com.ezardlabs.lostsector.objects.warframes;

import com.ezardlabs.dethsquare.GameObject;
import com.ezardlabs.dethsquare.Vector2;
import com.ezardlabs.dethsquare.multiplayer.Network;
import com.ezardlabs.lostsector.objects.Player;
import com.ezardlabs.lostsector.objects.warframes.abilities.frost.Avalanche;
import com.ezardlabs.lostsector.objects.weapons.melee.Nikana;
import com.ezardlabs.lostsector.objects.weapons.primary.Lanka;

public class Frost extends Warframe {

	public Frost() {
		super("frost", 15, 3, 150);
	}

	@Override
	public void start() {
		super.start();
		gameObject.renderer.setzIndex(4);
//		gameObject.animator.addAnimations(new Animation("cast_avalanche", new Sprite[]{ta.getSprite("avalanche0"),
//				ta.getSprite("avalanche1"),
//				ta.getSprite("avalanche2"),
//				ta.getSprite("avalanche3"),
//				ta.getSprite("avalanche4"),
//				ta.getSprite("avalanche5"),
//				ta.getSprite("avalanche6"),
//				ta.getSprite("avalanche7"),
//				ta.getSprite("avalanche8"),
//				ta.getSprite("avalanche8"),
//				ta.getSprite("avalanche10"),
//				ta.getSprite("avalanche11"),
//				ta.getSprite("avalanche12"),
//				ta.getSprite("avalanche13")}, AnimationType.ONE_SHOT, 100, new Animation.AnimationListener() {
//			@Override
//			public void onAnimatedStarted(Animator animator) {
//
//			}
//
//			@Override
//			public void onFrame(Animator animator, int frameNum) {
//
//			}
//
//			@Override
//			public void onAnimationFinished(Animator animator) {
//				Player p;
//				if ((p = animator.gameObject.getComponent(Player.class)) != null) {
//					p.state = Player.State.IDLE;
//				}
//			}
//		}));
		setPrimaryWeapon(new Lanka());
		setMeleeWeapon(new Nikana(gameObject));
	}

	@Override
	public String getName() {
		return "Frost";
	}

	@Override
	protected String getAtlasPath() {
		return "data/warframes/frost";
	}

	@Override
	protected String getAnimationPath() {
		return "data/warframes/frost";
	}

	@Override
	public void ability1() {
		GameObject freeze = Network.instantiate("freeze", new Vector2(
				gameObject.transform.scale.x < 0 ? transform.position.x :
						transform.position.x + 100, transform.position.y + 50));
		freeze.transform.scale.set(gameObject.transform.scale);
		//noinspection ConstantConditions
//		freeze.getComponent(Freeze.class)
//			  .setDirection(gameObject.transform.scale.x < 0 ? -1 : 1);
	}

	@Override
	public void ability2() {
		//noinspection ConstantConditions
		if (gameObject.getComponent(Player.class).jumpCount == 0) {
			GameObject iceWave = Network.instantiate("ice_wave", new Vector2(
					gameObject.transform.scale.x < 0 ?
							transform.position.x - 800 :
							transform.position.x + 200,
					transform.position.y - 200));
			//noinspection ConstantConditions
//			iceWave.getComponent(IceWave.class)
//				   .setDirection(gameObject.transform.scale.x < 0 ? -1 : 1);
			iceWave.transform.scale.set(transform.scale);
		}
	}

	@Override
	public void ability3() {
		Network.instantiate("snowglobe", transform.position.offset(-300, -200));
	}

	@Override
	public void ability4() {
		gameObject.animator.play("cast_avalanche");
		GameObject.instantiate(new GameObject("Avalanche", new Avalanche()), transform.position.offset(-300, -100));
	}
}

@@ -617,1026 +617,8 @@
 4);%0A
-//%09%09gameObject.animator.addAnimations(new Animation(%22cast_avalanche%22, new Sprite%5B%5D%7Bta.getSprite(%22avalanche0%22),%0A//%09%09%09%09ta.getSprite(%22avalanche1%22),%0A//%09%09%09%09ta.getSprite(%22avalanche2%22),%0A//%09%09%09%09ta.getSprite(%22avalanche3%22),%0A//%09%09%09%09ta.getSprite(%22avalanche4%22),%0A//%09%09%09%09ta.getSprite(%22avalanche5%22),%0A//%09%09%09%09ta.getSprite(%22avalanche6%22),%0A//%09%09%09%09ta.getSprite(%22avalanche7%22),%0A//%09%09%09%09ta.getSprite(%22avalanche8%22),%0A//%09%09%09%09ta.getSprite(%22avalanche8%22),%0A//%09%09%09%09ta.getSprite(%22avalanche10%22),%0A//%09%09%09%09ta.getSprite(%22avalanche11%22),%0A//%09%09%09%09ta.getSprite(%22avalanche12%22),%0A//%09%09%09%09ta.getSprite(%22avalanche13%22)%7D, AnimationType.ONE_SHOT, 100, new Animation.AnimationListener() %7B%0A//%09%09%09@Override%0A//%09%09%09public void onAnimatedStarted(Animator animator) %7B%0A//%0A//%09%09%09%7D%0A//%0A//%09%09%09@Override%0A//%09%09%09public void onFrame(Animator animator, int frameNum) %7B%0A//%0A//%09%09%09%7D%0A//%0A//%09%09%09@Override%0A//%09%09%09public void onAnimationFinished(Animator animator) %7B%0A//%09%09%09%09Player p;%0A//%09%09%09%09if ((p = animator.gameObject.getComponent(Player.class)) != null) %7B%0A//%09%09%09%09%09p.state = Player.State.IDLE;%0A//%09%09%09%09%7D%0A//%09%09%09%7D%0A//%09%09%7D));%0A
 %09%09se
@@ -1211,147 +1211,8 @@
 e);%0A
-%09%09//noinspection ConstantConditions%0A//%09%09freeze.getComponent(Freeze.class)%0A//%09%09%09  .setDirection(gameObject.transform.scale.x %3C 0 ? -1 : 1);%0A
 %09%7D%0A%0A
@@ -1526,16 +1526,16 @@
  + 200,%0A
+
 %09%09%09%09%09tra
@@ -1565,153 +1565,8 @@
 ));%0A
-%09%09%09//noinspection ConstantConditions%0A//%09%09%09iceWave.getComponent(IceWave.class)%0A//%09%09%09%09   .setDirection(gameObject.transform.scale.x %3C 0 ? -1 : 1);%0A
 %09%09%09i

Remove commented code