|
|
|
@ -46,7 +46,7 @@ void BitRestorer::Attack(Unit&victim,std::vector<std::shared_ptr<Unit>>&otherUni |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
int randomBit=emptyMemoryPositions[rand()%emptyMemoryPositions.size()]; |
|
|
|
|
victim.memory[randomBit]=victim.ghostMemory[randomBit]=true; |
|
|
|
|
victim.memory[randomBit]=true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void BitRestorer::AttemptToHealOtherAllies(std::vector<std::shared_ptr<Unit>>&otherUnits){ |
|
|
|
@ -60,7 +60,7 @@ void BitRestorer::AttemptToHealOtherAllies(std::vector<std::shared_ptr<Unit>>&ot |
|
|
|
|
} |
|
|
|
|
if(emptyMemoryPositions.size()!=0){ |
|
|
|
|
int randomBit=emptyMemoryPositions[rand()%emptyMemoryPositions.size()]; |
|
|
|
|
u->memory[randomBit]=u->ghostMemory[randomBit]=true; |
|
|
|
|
u->memory[randomBit]=true; |
|
|
|
|
appliedTarget=u; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -79,12 +79,12 @@ MemorySwapper::MemorySwapper(PixelGameEngine*pge,vf2d pos,std::map<Image,std::un |
|
|
|
|
void MemorySwapper::Attack(Unit&victim,std::vector<std::shared_ptr<Unit>>&otherUnits){ |
|
|
|
|
std::vector<bool>oldMemory=victim.memory; |
|
|
|
|
for(int i=0;i<oldMemory.size();i++){ |
|
|
|
|
victim.memory[i]=victim.ghostMemory[i]=oldMemory[oldMemory.size()-i-1]; |
|
|
|
|
victim.memory[i]=oldMemory[oldMemory.size()-i-1]; |
|
|
|
|
} |
|
|
|
|
std::vector<Marker*>order; |
|
|
|
|
for(int i=0;i<5;i++){ |
|
|
|
|
int lowestInd=999999; |
|
|
|
|
Marker*lowest; |
|
|
|
|
Marker*lowest=nullptr; |
|
|
|
|
if(victim.health.index<lowestInd){lowest=&victim.health;lowestInd=lowest->index;} |
|
|
|
|
if(victim.range.index<lowestInd){lowest=&victim.range;lowestInd=lowest->index;} |
|
|
|
|
if(victim.atkSpd.index<lowestInd){lowest=&victim.atkSpd;lowestInd=lowest->index;} |
|
|
|
@ -102,6 +102,12 @@ void MemorySwapper::Attack(Unit&victim,std::vector<std::shared_ptr<Unit>>&otherU |
|
|
|
|
marker+=order[i]->size; |
|
|
|
|
i++; |
|
|
|
|
} |
|
|
|
|
//Clean up after ourselves for any 0-sized stats.
|
|
|
|
|
if(victim.health.index==9999999)victim.health.index=0; |
|
|
|
|
if(victim.range.index==9999999)victim.range.index=0; |
|
|
|
|
if(victim.atkSpd.index==9999999)victim.atkSpd.index=0; |
|
|
|
|
if(victim.moveSpd.index==9999999)victim.moveSpd.index=0; |
|
|
|
|
if(victim.procedure.index==9999999)victim.procedure.index=0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::string Corrupter::unitName="Corrupter"; |
|
|
|
@ -113,7 +119,7 @@ Corrupter::Corrupter(PixelGameEngine*pge,vf2d pos,std::map<Image,std::unique_ptr |
|
|
|
|
void Corrupter::Attack(Unit&victim,std::vector<std::shared_ptr<Unit>>&otherUnits){ |
|
|
|
|
//Chooses a bit at random and corrupts it.
|
|
|
|
|
int randomBit=rand()%victim.memory.size(); |
|
|
|
|
victim.memory[randomBit]=victim.ghostMemory[randomBit]=false; |
|
|
|
|
victim.memory[randomBit]=false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::string MemoryAllocator::unitName="Memory Allocator"; |
|
|
|
@ -291,7 +297,7 @@ Refresher::Refresher(PixelGameEngine*pge,vf2d pos,std::map<Image,std::unique_ptr |
|
|
|
|
void Refresher::Attack(Unit&victim,std::vector<std::shared_ptr<Unit>>&otherUnits){ |
|
|
|
|
//Chooses a bit at random and corrupts it.
|
|
|
|
|
int randomBit=rand()%victim.memory.size(); |
|
|
|
|
victim.memory[randomBit]=victim.ghostMemory[randomBit]=false; |
|
|
|
|
victim.memory[randomBit]=false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::string Turret::unitName="Turret"; |
|
|
|
@ -303,7 +309,7 @@ Turret::Turret(PixelGameEngine*pge,vf2d pos,std::map<Image,std::unique_ptr<Rende |
|
|
|
|
void Turret::Attack(Unit&victim,std::vector<std::shared_ptr<Unit>>&otherUnits){ |
|
|
|
|
//Chooses a bit at random and corrupts it.
|
|
|
|
|
int randomBit=rand()%victim.memory.size(); |
|
|
|
|
victim.memory[randomBit]=victim.ghostMemory[randomBit]=false; |
|
|
|
|
victim.memory[randomBit]=false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::string MemoryGuard::unitName="Memory Guard"; |
|
|
|
@ -412,19 +418,19 @@ void Unit::_DrawHud(TileTransformedView&game,std::map<Image,std::unique_ptr<Rend |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto CheckColor=[&](int i,Pixel&col){ |
|
|
|
|
if(health.index==i){ |
|
|
|
|
if(health.index==i&&health.size>0){ |
|
|
|
|
col=CONSTANT::HEALTH_COLOR; |
|
|
|
|
} |
|
|
|
|
if(range.index==i){ |
|
|
|
|
if(range.index==i&&range.size>0){ |
|
|
|
|
col=CONSTANT::RANGE_COLOR; |
|
|
|
|
} |
|
|
|
|
if(atkSpd.index==i){ |
|
|
|
|
if(atkSpd.index==i&&atkSpd.size>0){ |
|
|
|
|
col=CONSTANT::ATKSPD_COLOR; |
|
|
|
|
} |
|
|
|
|
if(moveSpd.index==i){ |
|
|
|
|
if(moveSpd.index==i&&moveSpd.size>0){ |
|
|
|
|
col=CONSTANT::MOVESPD_COLOR; |
|
|
|
|
} |
|
|
|
|
if(procedure.index==i){ |
|
|
|
|
if(procedure.index==i&&procedure.size>0){ |
|
|
|
|
col=CONSTANT::PROCEDURE_COLOR; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
@ -616,6 +622,10 @@ void Unit::_Update(PixelGameEngine*pge,std::map<Sound,std::unique_ptr<Audio>>&SO |
|
|
|
|
HideGhost(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(!InFogOfWar()){ |
|
|
|
|
ghostMemory=memory; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
reloadTimer=std::max(0.f,reloadTimer-pge->GetElapsedTime()); |
|
|
|
|
guardTime=std::max(0.f,guardTime-pge->GetElapsedTime()); |
|
|
|
|
lineShift-=pge->GetElapsedTime(); |
|
|
|
|