#include "DebuffIcon.h"

void DebuffIcon::Update(float fElapsedTime){
	pos.y-=6*fElapsedTime;
	lifetime-=fElapsedTime;
}

void DebuffIcon::Draw(TileTransformedView&game){
	game.DrawRotatedDecal(pos,icon->Decal(),0,icon->Sprite()->Size()/2,{1,1},{255,255,255,uint8_t((lifetime/CONSTANT::DEBUFFICON_LIFETIME)*255)});
	game.DrawRotatedDecal(pos+vf2d{4,-4},redXIcon->Decal(),0,icon->Sprite()->Size()/2,{1,1},{255,255,255,uint8_t((lifetime/CONSTANT::DEBUFFICON_LIFETIME)*255)});
}

void ResourceGainIcon::Update(float fElapsedTime){
	pos.y-=6*fElapsedTime;
	lifetime-=fElapsedTime;
}

void ResourceGainIcon::Draw(TileTransformedView&game){
	Pixel col;
	switch(type){
		case HEALTH:{
			col=CONSTANT::HEALTH_COLOR;
		}break;
		case RANGE:{
			col=CONSTANT::RANGE_COLOR;
		}break;
		case ATKSPD:{
			col=CONSTANT::ATKSPD_COLOR;
		}break;
		case MOVESPD:{
			col=CONSTANT::MOVESPD_COLOR;
		}break;
		case PROCEDURE:{
			col=CONSTANT::PROCEDURE_COLOR;
		}break;
	}
	game.DrawRotatedDecal(pos,icon->Decal(),0,icon->Sprite()->Size()/2,{1,1},{col.r,col.g,col.b,uint8_t((lifetime/CONSTANT::DEBUFFICON_LIFETIME)*255)});
	game.DrawShadowStringDecal(pos-vf2d{-2,-2},"+1",col);
}