#include "entity.h"
#include "object.h"

extern std::array<std::string,7> PARTY_MEMBER_NAMES;

std::ostream&operator<<(std::ostream &os,Entity&ent){
    os<<
    ent.GetHP()<<" "<<
    ent.stats.maxHP<<" "<<
    PARTY_MEMBER_NAMES[ent.partyMemberID]<<" "<<
    ent.GetPP()<<" "<<
    ent.stats.maxPP<<" "<<
    ent.stats.baseAtk<<" "<<
    ent.stats.speed<<" "<<
    ent.stats.resistances.size()<<" ";
    for (int i=0;i<ent.stats.resistances.size();i++) {
        os<<ent.stats.resistances[i]<<" ";
    }
    os<<ent.stats.damageReduction<<" "<<
    ent.stats.smart<<" "<<
    ent.stats.dumb<<" "<<
    ent.moveSet.size()<<" ";
    for (int i=0;i<ent.moveSet.size();i++) {
        os<<(int)ent.moveSet[i]->id<<" ";
    }
    os<<ent.statusEffects.size()<<" ";
    for (std::map<Property,int>::iterator it=ent.statusEffects.begin();it!=ent.statusEffects.end();++it) {
        os<<(int)it->first<<" "<<it->second<<" ";
    }
    os<<ent.equipment.size()<<" ";
    for (int i=0;i<3;i++) {
        if (ent.equipment[i]!=nullptr) {
            os<<(int)ent.equipment[i]->id<<" ";
        } else {
            os<<-1<<" ";
        }
    }
    if (ent.obj!=nullptr) {
        os<<ent.obj->GetPos().x<<" "<<ent.obj->GetPos().y<<" ";
    } else {
        os<<-999<<" "<<-999<<" ";
    }
    return os;
}