|
|
|
@ -4,99 +4,99 @@ |
|
|
|
|
#include "TileManager.h" |
|
|
|
|
#include "util.h" |
|
|
|
|
|
|
|
|
|
BasicUnit::BasicUnit(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly) |
|
|
|
|
BasicUnit::BasicUnit(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly,bool moveable) |
|
|
|
|
:Unit({ |
|
|
|
|
{HEALTH,4}, |
|
|
|
|
{RANGE,2}, |
|
|
|
|
{ATKSPD,2}, |
|
|
|
|
{MOVESPD,3}, |
|
|
|
|
{PROCEDURE,1}, |
|
|
|
|
},pos,*IMAGES[VIRUS_IMG1],friendly){} |
|
|
|
|
},pos,*IMAGES[VIRUS_IMG1],friendly,moveable){} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void BasicUnit::Attack(Unit&victim){ |
|
|
|
|
victim<<=1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BasicUnit2::BasicUnit2(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly) |
|
|
|
|
BasicUnit2::BasicUnit2(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly,bool moveable) |
|
|
|
|
:Unit({ |
|
|
|
|
{RANGE,2}, |
|
|
|
|
{ATKSPD,2}, |
|
|
|
|
{MOVESPD,3}, |
|
|
|
|
{PROCEDURE,1}, |
|
|
|
|
{HEALTH,4}, |
|
|
|
|
},pos,*IMAGES[VIRUS_IMG1],friendly){} |
|
|
|
|
},pos,*IMAGES[VIRUS_IMG1],friendly,moveable){} |
|
|
|
|
|
|
|
|
|
void BasicUnit2::Attack(Unit&victim){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
LeftShifter::LeftShifter(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly) |
|
|
|
|
LeftShifter::LeftShifter(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly,bool moveable) |
|
|
|
|
:Unit({ |
|
|
|
|
{RANGE,2}, |
|
|
|
|
{ATKSPD,2}, |
|
|
|
|
{MOVESPD,3}, |
|
|
|
|
{PROCEDURE,1}, |
|
|
|
|
{HEALTH,4}, |
|
|
|
|
},pos,*IMAGES[LEFT_SHIFTER],friendly){} |
|
|
|
|
},pos,*IMAGES[LEFT_SHIFTER],friendly,moveable){} |
|
|
|
|
|
|
|
|
|
void LeftShifter::Attack(Unit&victim){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
RightShifter::RightShifter(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly) |
|
|
|
|
RightShifter::RightShifter(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly,bool moveable) |
|
|
|
|
:Unit({ |
|
|
|
|
{HEALTH,4}, |
|
|
|
|
{RANGE,2}, |
|
|
|
|
{ATKSPD,2}, |
|
|
|
|
{MOVESPD,3}, |
|
|
|
|
{PROCEDURE,1}, |
|
|
|
|
},pos,*IMAGES[RIGHT_SHIFTER],friendly){} |
|
|
|
|
},pos,*IMAGES[RIGHT_SHIFTER],friendly,moveable){} |
|
|
|
|
|
|
|
|
|
void RightShifter::Attack(Unit&victim){ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BitRestorer::BitRestorer(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly) |
|
|
|
|
BitRestorer::BitRestorer(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly,bool moveable) |
|
|
|
|
:Unit({ |
|
|
|
|
{PROCEDURE,6}, |
|
|
|
|
{RANGE,1}, |
|
|
|
|
{ATKSPD,1}, |
|
|
|
|
{MOVESPD,1}, |
|
|
|
|
{HEALTH,2}, |
|
|
|
|
},pos,*IMAGES[BIT_RESTORER],friendly){} |
|
|
|
|
},pos,*IMAGES[BIT_RESTORER],friendly,moveable){} |
|
|
|
|
|
|
|
|
|
void BitRestorer::Attack(Unit&victim){ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MemorySwapper::MemorySwapper(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly) |
|
|
|
|
MemorySwapper::MemorySwapper(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly,bool moveable) |
|
|
|
|
:Unit({ |
|
|
|
|
{RANGE,3}, |
|
|
|
|
{ATKSPD,1}, |
|
|
|
|
{HEALTH,3}, |
|
|
|
|
{PROCEDURE,3}, |
|
|
|
|
{MOVESPD,2}, |
|
|
|
|
},pos,*IMAGES[MEMORY_SWAPPER],friendly){} |
|
|
|
|
},pos,*IMAGES[MEMORY_SWAPPER],friendly,moveable){} |
|
|
|
|
|
|
|
|
|
void MemorySwapper::Attack(Unit&victim){ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Corrupter::Corrupter(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly) |
|
|
|
|
Corrupter::Corrupter(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly,bool moveable) |
|
|
|
|
:Unit({ |
|
|
|
|
{ATKSPD,3}, |
|
|
|
|
{RANGE,1}, |
|
|
|
|
{PROCEDURE,8}, |
|
|
|
|
{MOVESPD,4}, |
|
|
|
|
{HEALTH,4}, |
|
|
|
|
},pos,*IMAGES[CORRUPTER],friendly){} |
|
|
|
|
},pos,*IMAGES[CORRUPTER],friendly,moveable){} |
|
|
|
|
|
|
|
|
|
void Corrupter::Attack(Unit&victim){ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
MemoryAllocator::MemoryAllocator(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly) |
|
|
|
|
MemoryAllocator::MemoryAllocator(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly,bool moveable) |
|
|
|
|
:Unit({ |
|
|
|
|
{RANGE,1}, |
|
|
|
|
{ATKSPD,1}, |
|
|
|
@ -116,7 +116,7 @@ RAMBank::RAMBank(PixelGameEngine*pge,vf2d pos,std::map<Image,std::unique_ptr<Ren |
|
|
|
|
{MOVESPD,0}, |
|
|
|
|
{PROCEDURE,25}, |
|
|
|
|
{HEALTH,16}, |
|
|
|
|
},pos,*IMAGES[RAM_BANK],friendly),randomOffset({util::random(128),util::random(128)}),matrixImg(*IMAGES[MATRIX]), |
|
|
|
|
},pos,*IMAGES[RAM_BANK],friendly,false),randomOffset({util::random(128),util::random(128)}),matrixImg(*IMAGES[MATRIX]), |
|
|
|
|
originalImg(*IMAGES[RAM_BANK]){ |
|
|
|
|
img.Create(IMAGES[RAM_BANK]->Sprite()->width,IMAGES[RAM_BANK]->Sprite()->height); |
|
|
|
|
pge->SetDrawTarget(img.Sprite()); |
|
|
|
@ -150,8 +150,8 @@ void RAMBank::Draw(TileTransformedView&game,std::map<Image,std::unique_ptr<Rende |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Unit::Unit(std::vector<Memory>memory,vf2d pos,Renderable&img,bool friendly) |
|
|
|
|
:pos(pos),ghostPos(pos),img(img),friendly(friendly){ |
|
|
|
|
Unit::Unit(std::vector<Memory>memory,vf2d pos,Renderable&img,bool friendly,bool moveable) |
|
|
|
|
:pos(pos),ghostPos(pos),img(img),friendly(friendly),moveable(moveable){ |
|
|
|
|
int marker=0; |
|
|
|
|
for(Memory&mem:memory){ |
|
|
|
|
for(int i=0;i<mem.size;i++){ |
|
|
|
@ -422,4 +422,8 @@ void Unit::HideGhost(){ |
|
|
|
|
|
|
|
|
|
vf2d Unit::GetGhostPos(){ |
|
|
|
|
return ghostPos; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool Unit::IsMoveable(){ |
|
|
|
|
return moveable; |
|
|
|
|
} |