#pragma once
#include "cocos2d.h"

struct PRect
{
	cocos2d::Vec2 center;
	cocos2d::Vec2 size;

	PRect(cocos2d::Vec2 _center,cocos2d::Vec2 _size):
		center(_center),
		size(_size){};

	PRect(void):
		center(cocos2d::Vec2(0,0)),
		size(cocos2d::Vec2(0,0)){};
};

#define ATTACK_NONE		-1
#define ATTACK_FORWARD	0
#define ATTACK_UP		1
#define	ATTACK_DOWN		2
#define ATTACK_SPECIAL	3
#define ATTACK_THROW	4

struct AttackProp
{
	float range; //speed for throw 
	int damage;  //id for throw
	int type;    
	int count;   // id of damage property for throw 
	float calldown;
	float animDT;
	cocos2d::Vec2 attackSize; // size of bullet for throw
	cocos2d::Vec2 direction;
	bool stun;
	bool pushBack;
	bool selfDestruction;

	AttackProp():
		range(0),
		damage(0),
		count(0),
		type(ATTACK_NONE),
		calldown(0),
		animDT(0.1),
		attackSize(cocos2d::Vec2(0,0)),
		direction(cocos2d::Vec2(0,0)),
		stun(false),
		pushBack(false),
		selfDestruction(false){};

	AttackProp(
		float _range,
		int _damage,
		int _type,
		int _count,
		float _calldown,
		float _animDT,
		cocos2d::Vec2 _attackSize,
		cocos2d::Vec2 _direction,
		bool _stun,
		bool _pushBack,
		bool _selfDestruction):
		range(_range),
		damage(_damage),
		type(_type),
		count(_count),
		calldown(_calldown),
		animDT(_animDT),
		attackSize(_attackSize),
		direction(_direction),
		stun(_stun),
		pushBack(_pushBack),
		selfDestruction(_selfDestruction){};
};

struct ARect : public PRect
{
	unsigned team;
	AttackProp* prop;
	cocos2d::Vec2 direction; 

	ARect(cocos2d::Vec2 _center,
		AttackProp* _prop,
		unsigned _team,
		cocos2d::Vec2 _direction):
		PRect(_center,_prop->attackSize),
		prop(_prop),
		team(_team),
		direction(_direction){};
	ARect():
		PRect(),
		prop(NULL),
		team(0),
		direction(0,0){};
};

bool rectConflict(PRect* r1, PRect* r2);

