@ -22,7 +22,7 @@ _Platform::~_Platform(){};
std : : string LeftShifter : : unitName = " Left Shifter " ;
std : : string LeftShifter : : unitDescription = " Shifts target memory 1 bit to the left. " ;
std : : vector < Memory > LeftShifter : : resourceCost = { { RANGE , 2 } , { ATKSPD , 2 } , { MOVESPD , 6 } , { PROCEDURE , 1 } , { HEALTH , 4 } } ;
LeftShifter : : LeftShifter ( PixelGameEngine * pge , vf2d pos , std : : map < Image , Renderable > & IMAGES , bool friendly , bool moveable )
LeftShifter : : LeftShifter ( PixelGameEngine * pge , vf2d pos , std : : vector < Renderable > & IMAGES , bool friendly , bool moveable )
: Unit ( pge , LeftShifter : : resourceCost , pos , 12 , IMAGES [ LEFT_SHIFTER ] , CONSTANT : : ATTACKER_TARGET_COL , CONSTANT : : ATTACKER_ATTACK_COL , friendly , moveable ) { }
void LeftShifter : : Attack ( Unit & victim , std : : vector < std : : shared_ptr < Unit > > & otherUnits ) {
@ -32,7 +32,7 @@ void LeftShifter::Attack(Unit&victim,std::vector<std::shared_ptr<Unit>>&otherUni
std : : string RightShifter : : unitName = " Right Shifter " ;
std : : string RightShifter : : unitDescription = " Shifts target memory 1 bit to the right. " ;
std : : vector < Memory > RightShifter : : resourceCost = { { HEALTH , 4 } , { RANGE , 2 } , { ATKSPD , 2 } , { MOVESPD , 6 } , { PROCEDURE , 1 } } ;
RightShifter : : RightShifter ( PixelGameEngine * pge , vf2d pos , std : : map < Image , Renderable > & IMAGES , bool friendly , bool moveable )
RightShifter : : RightShifter ( PixelGameEngine * pge , vf2d pos , std : : vector < Renderable > & IMAGES , bool friendly , bool moveable )
: Unit ( pge , RightShifter : : resourceCost , pos , 12 , IMAGES [ RIGHT_SHIFTER ] , CONSTANT : : ATTACKER_TARGET_COL , CONSTANT : : ATTACKER_ATTACK_COL , friendly , moveable ) { }
void RightShifter : : Attack ( Unit & victim , std : : vector < std : : shared_ptr < Unit > > & otherUnits ) {
@ -42,7 +42,7 @@ void RightShifter::Attack(Unit&victim,std::vector<std::shared_ptr<Unit>>&otherUn
std : : string BitRestorer : : unitName = " Bit Restorer " ;
std : : string BitRestorer : : unitDescription = " Randomly restores 1 missing bit to a target. " ;
std : : vector < Memory > BitRestorer : : resourceCost = { { PROCEDURE , 6 } , { RANGE , 1 } , { ATKSPD , 1 } , { MOVESPD , 2 } , { HEALTH , 2 } } ;
BitRestorer : : BitRestorer ( PixelGameEngine * pge , vf2d pos , std : : map < Image , Renderable > & IMAGES , bool friendly , bool moveable )
BitRestorer : : BitRestorer ( PixelGameEngine * pge , vf2d pos , std : : vector < Renderable > & IMAGES , bool friendly , bool moveable )
: Unit ( pge , BitRestorer : : resourceCost , pos , 12 , IMAGES [ BIT_RESTORER ] , CONSTANT : : HEALER_TARGET_COL , CONSTANT : : HEALER_ATTACK_COL , friendly , moveable , true , false ) { }
void BitRestorer : : Attack ( Unit & victim , std : : vector < std : : shared_ptr < Unit > > & otherUnits ) {
@ -84,7 +84,7 @@ void BitRestorer::AttemptToHealOtherAllies(std::vector<std::shared_ptr<Unit>>&ot
std : : string MemorySwapper : : unitName = " Memory Swapper " ;
std : : string MemorySwapper : : unitDescription = " Flips the orientation of all bits of a target around. " ;
std : : vector < Memory > MemorySwapper : : resourceCost = { { RANGE , 3 } , { ATKSPD , 1 } , { HEALTH , 3 } , { PROCEDURE , 3 } , { MOVESPD , 4 } } ;
MemorySwapper : : MemorySwapper ( PixelGameEngine * pge , vf2d pos , std : : map < Image , Renderable > & IMAGES , bool friendly , bool moveable )
MemorySwapper : : MemorySwapper ( PixelGameEngine * pge , vf2d pos , std : : vector < Renderable > & IMAGES , bool friendly , bool moveable )
: Unit ( pge , MemorySwapper : : resourceCost , pos , 12 , IMAGES [ MEMORY_SWAPPER ] , CONSTANT : : ATTACKER_TARGET_COL , CONSTANT : : ATTACKER_ATTACK_COL , friendly , moveable , true ) {
autoAcquireFriendlyTarget = false ;
}
@ -128,7 +128,7 @@ void MemorySwapper::Attack(Unit&victim,std::vector<std::shared_ptr<Unit>>&otherU
std : : string Corrupter : : unitName = " Corrupter " ;
std : : string Corrupter : : unitDescription = " Chooses a random bit and negates it on a target. " ;
std : : vector < Memory > Corrupter : : resourceCost = { { ATKSPD , 3 } , { RANGE , 1 } , { PROCEDURE , 8 } , { MOVESPD , 8 } , { HEALTH , 4 } } ;
Corrupter : : Corrupter ( PixelGameEngine * pge , vf2d pos , std : : map < Image , Renderable > & IMAGES , bool friendly , bool moveable )
Corrupter : : Corrupter ( PixelGameEngine * pge , vf2d pos , std : : vector < Renderable > & IMAGES , bool friendly , bool moveable )
: Unit ( pge , Corrupter : : resourceCost , pos , 12 , IMAGES [ CORRUPTER ] , CONSTANT : : ATTACKER_TARGET_COL , CONSTANT : : ATTACKER_ATTACK_COL , friendly , moveable ) { }
void Corrupter : : Attack ( Unit & victim , std : : vector < std : : shared_ptr < Unit > > & otherUnits ) {
@ -140,7 +140,7 @@ void Corrupter::Attack(Unit&victim,std::vector<std::shared_ptr<Unit>>&otherUnits
std : : string MemoryAllocator : : unitName = " Memory Allocator " ;
std : : string MemoryAllocator : : unitDescription = " A unit that builds other units. " ;
std : : vector < Memory > MemoryAllocator : : resourceCost = { { RANGE , 1 } , { ATKSPD , 1 } , { MOVESPD , 2 } , { PROCEDURE , 1 } , { HEALTH , 1 } } ;
MemoryAllocator : : MemoryAllocator ( PixelGameEngine * pge , vf2d pos , std : : map < Image , Renderable > & IMAGES , bool friendly , bool moveable )
MemoryAllocator : : MemoryAllocator ( PixelGameEngine * pge , vf2d pos , std : : vector < Renderable > & IMAGES , bool friendly , bool moveable )
: Unit ( pge , MemoryAllocator : : resourceCost , pos , 12 , IMAGES [ UNIT_ALLOCATOR ] , CONSTANT : : ATTACKER_TARGET_COL , CONSTANT : : ATTACKER_ATTACK_COL , friendly , true , false ) {
isAllocator = true ;
}
@ -163,7 +163,7 @@ void MemoryAllocator::Update(PixelGameEngine*pge,std::map<Sound,std::unique_ptr<
}
}
void MemoryAllocator : : Draw ( TileTransformedView & game , std : : map < Image , Renderable > & IMAGES ) {
void MemoryAllocator : : Draw ( TileTransformedView & game , std : : vector < Renderable > & IMAGES ) {
if ( IsBuilding ( ) ) {
game . GetPGE ( ) - > SetDrawTarget ( img . Sprite ( ) ) ;
game . GetPGE ( ) - > Clear ( BLANK ) ;
@ -185,7 +185,7 @@ void MemoryAllocator::Draw(TileTransformedView&game,std::map<Image,Renderable>&I
std : : string RAMBank : : unitName = " RAM Bank " ;
std : : string RAMBank : : unitDescription = " Allows for the construction of Memory Allocators. " ;
std : : vector < Memory > RAMBank : : resourceCost = { { PROCEDURE , 25 } , { HEALTH , 16 } } ;
RAMBank : : RAMBank ( PixelGameEngine * pge , vf2d pos , std : : map < Image , Renderable > & IMAGES , bool friendly )
RAMBank : : RAMBank ( PixelGameEngine * pge , vf2d pos , std : : vector < Renderable > & IMAGES , bool friendly )
: Unit ( pge , RAMBank : : resourceCost , pos , 41 , IMAGES [ RAM_BANK ] , WHITE , WHITE , friendly , false
, false , false
) , randomOffset ( { util : : random ( 128 ) , util : : random ( 128 ) } ) , matrixImg ( IMAGES [ MATRIX ] ) ,
@ -226,13 +226,13 @@ void RAMBank::Update(PixelGameEngine*pge,std::map<Sound,std::unique_ptr<Audio>>&
pge - > SetDrawTarget ( nullptr ) ;
}
void RAMBank : : DrawHud ( TileTransformedView & game , std : : map < Image , Renderable > & IMAGES ) {
void RAMBank : : DrawHud ( TileTransformedView & game , std : : vector < Renderable > & IMAGES ) {
if ( IsSelected ( ) ) {
allocatorManager . DrawDecal ( game ) ;
}
}
void RAMBank : : Draw ( TileTransformedView & game , std : : map < Image , Renderable > & IMAGES ) {
void RAMBank : : Draw ( TileTransformedView & game , std : : vector < Renderable > & IMAGES ) {
game . DrawRotatedDecal ( GetGhostPos ( ) , img . Decal ( ) , 0 , img . Sprite ( ) - > Size ( ) / 2 , { 1 , 1 } , GetUnitColor ( ) ) ;
if ( IsSelected ( ) ) {
game . DrawRotatedDecal ( GetGhostPos ( ) , IMAGES [ SELECTION_CIRCLE ] . Decal ( ) , 0 , IMAGES [ SELECTION_CIRCLE ] . Sprite ( ) - > Size ( ) / 2 , vf2d ( img . Sprite ( ) - > Size ( ) ) / IMAGES [ SELECTION_CIRCLE ] . Sprite ( ) - > Size ( ) , WHITE ) ;
@ -261,7 +261,7 @@ void RAMBank::UpdateGUIState(TileTransformedView&game,Resources&player_resources
allocatorButton - > Enable ( buttonEnabled ) ;
}
bool RAMBank : : ClickHandled ( TileTransformedView & game , Resources & player_resources , std : : vector < std : : shared_ptr < Unit > > & units , std : : map < Image , Renderable > & IMAGES ) {
bool RAMBank : : ClickHandled ( TileTransformedView & game , Resources & player_resources , std : : vector < std : : shared_ptr < Unit > > & units , std : : vector < Renderable > & IMAGES ) {
if ( allocatorButton - > bPressed ) {
//First try to take one of each.
if ( player_resources . atkSpd > 0 & & player_resources . health > 0 & & player_resources . moveSpd > 0 & & player_resources . procedure > 0 & & player_resources . range > 0 ) {
@ -298,7 +298,7 @@ bool RAMBank::ClickHandled(TileTransformedView&game,Resources&player_resources,s
std : : string _Platform : : unitName = " Platform " ;
std : : string _Platform : : unitDescription = " Anchored to the ground, this unit is an intermediate step for larger units. " ;
std : : vector < Memory > _Platform : : resourceCost = { { HEALTH , 6 } } ;
_Platform : : _Platform ( PixelGameEngine * pge , vf2d pos , std : : map < Image , Renderable > & IMAGES , bool friendly , bool moveable )
_Platform : : _Platform ( PixelGameEngine * pge , vf2d pos , std : : vector < Renderable > & IMAGES , bool friendly , bool moveable )
: Unit ( pge , _Platform : : resourceCost , pos , 24 , IMAGES [ PLATFORM ] , CONSTANT : : ATTACKER_TARGET_COL , CONSTANT : : ATTACKER_ATTACK_COL , friendly , false ) {
isPlatform = true ;
}
@ -319,7 +319,7 @@ void _Platform::Update(PixelGameEngine*pge,std::map<Sound,std::unique_ptr<Audio>
}
}
void _Platform : : Draw ( TileTransformedView & game , std : : map < Image , Renderable > & IMAGES ) {
void _Platform : : Draw ( TileTransformedView & game , std : : vector < Renderable > & IMAGES ) {
if ( IsBuilding ( ) ) {
game . GetPGE ( ) - > SetDrawTarget ( img . Sprite ( ) ) ;
game . GetPGE ( ) - > Clear ( BLANK ) ;
@ -341,7 +341,7 @@ void _Platform::Draw(TileTransformedView&game,std::map<Image,Renderable>&IMAGES)
std : : string Refresher : : unitName = " Refresher " ;
std : : string Refresher : : unitDescription = " Repairs missing bits to surrounding units. " ;
std : : vector < Memory > Refresher : : resourceCost = { { ATKSPD , 3 } , { RANGE , 1 } , { PROCEDURE , 8 } , { HEALTH , 4 } } ;
Refresher : : Refresher ( PixelGameEngine * pge , vf2d pos , std : : map < Image , Renderable > & IMAGES , bool friendly , bool moveable )
Refresher : : Refresher ( PixelGameEngine * pge , vf2d pos , std : : vector < Renderable > & IMAGES , bool friendly , bool moveable )
: Unit ( pge , Refresher : : resourceCost , pos , 24 , IMAGES [ REFRESHER ] , CONSTANT : : ATTACKER_TARGET_COL , CONSTANT : : ATTACKER_ATTACK_COL , friendly , false
, true , false ) { }
@ -366,7 +366,7 @@ void Refresher::Attack(Unit&victim,std::vector<std::shared_ptr<Unit>>&otherUnits
std : : string Turret : : unitName = " Turret " ;
std : : string Turret : : unitDescription = " Automatically targets attack and movement speed memory ranges before others. " ;
std : : vector < Memory > Turret : : resourceCost = { { ATKSPD , 4 } , { RANGE , 5 } , { HEALTH , 6 } , { PROCEDURE , 16 } } ;
Turret : : Turret ( PixelGameEngine * pge , vf2d pos , std : : map < Image , Renderable > & IMAGES , bool friendly , bool moveable )
Turret : : Turret ( PixelGameEngine * pge , vf2d pos , std : : vector < Renderable > & IMAGES , bool friendly , bool moveable )
: Unit ( pge , Turret : : resourceCost , pos , 24 , IMAGES [ TURRET ] , CONSTANT : : ATTACKER_TARGET_COL , CONSTANT : : ATTACKER_ATTACK_COL , friendly , false ) { }
void Turret : : Attack ( Unit & victim , std : : vector < std : : shared_ptr < Unit > > & otherUnits ) {
@ -401,7 +401,7 @@ void Turret::Attack(Unit&victim,std::vector<std::shared_ptr<Unit>>&otherUnits){
std : : string MemoryGuard : : unitName = " Memory Guard " ;
std : : string MemoryGuard : : unitDescription = " Reduces the chance of bit modification for all surrounding units by 30% " ;
std : : vector < Memory > MemoryGuard : : resourceCost = { { HEALTH , 10 } , { ATKSPD , 4 } , { RANGE , 4 } , { PROCEDURE , 12 } } ;
MemoryGuard : : MemoryGuard ( PixelGameEngine * pge , vf2d pos , std : : map < Image , Renderable > & IMAGES , bool friendly , bool moveable )
MemoryGuard : : MemoryGuard ( PixelGameEngine * pge , vf2d pos , std : : vector < Renderable > & IMAGES , bool friendly , bool moveable )
: Unit ( pge , MemoryGuard : : resourceCost , pos , 24 , IMAGES [ MEMORY_GUARD ] , CONSTANT : : ATTACKER_TARGET_COL , CONSTANT : : ATTACKER_ATTACK_COL , friendly , false
, true , false ) { }
@ -451,7 +451,7 @@ Unit::Unit(PixelGameEngine*pge,std::vector<Memory>memory,vf2d pos,float radius,R
targetingLine . Create ( 25 , 24 , false , false ) ;
}
void Unit : : DrawRangeIndicator ( PixelGameEngine * pge , TileTransformedView & game , std : : map < Image , Renderable > & IMAGES ) {
void Unit : : DrawRangeIndicator ( PixelGameEngine * pge , TileTransformedView & game , std : : vector < Renderable > & IMAGES ) {
if ( ! CanInteractWithAllies ( ) & & ! CanInteractWithEnemies ( ) ) return ;
float dist = geom2d : : line < float > ( game . ScreenToWorld ( pge - > GetMousePos ( ) ) , GetGhostPos ( ) ) . length ( ) ;
float range = 12 * ( GetRange ( ) + 1 ) ;
@ -487,16 +487,16 @@ void Unit::DrawRangeIndicator(PixelGameEngine*pge,TileTransformedView&game,std::
}
}
void Unit : : Draw ( TileTransformedView & game , std : : map < Image , Renderable > & IMAGES ) {
void Unit : : Draw ( TileTransformedView & game , std : : vector < Renderable > & IMAGES ) {
game . DrawRotatedDecal ( GetGhostPos ( ) , img . Decal ( ) , 0 , img . Sprite ( ) - > Size ( ) / 2 , { 1 , 1 } , GetUnitColor ( ) ) ;
if ( IsSelected ( ) ) {
game . DrawRotatedDecal ( GetGhostPos ( ) , IMAGES [ SELECTION_CIRCLE ] . Decal ( ) , 0 , IMAGES [ SELECTION_CIRCLE ] . Sprite ( ) - > Size ( ) / 2 , vf2d ( img . Sprite ( ) - > Size ( ) ) / IMAGES [ SELECTION_CIRCLE ] . Sprite ( ) - > Size ( ) , WHITE ) ;
}
}
void Unit : : DrawHud ( TileTransformedView & game , std : : map < Image , Renderable > & IMAGES ) { }
void Unit : : DrawHud ( TileTransformedView & game , std : : vector < Renderable > & IMAGES ) { }
void Unit : : _DrawHud ( TileTransformedView & game , std : : map < Image , Renderable > & IMAGES ) {
void Unit : : _DrawHud ( TileTransformedView & game , std : : vector < Renderable > & IMAGES ) {
DrawHud ( game , IMAGES ) ;
int initialBarX = ghostPos . x - GetMemorySize ( ) / 2 * CONSTANT : : BAR_SQUARE_SIZE . x - CONSTANT : : BAR_SQUARE_SIZE . x / 2 ;
int initialBarY = ghostPos . y - CONSTANT : : BAR_SQUARE_SIZE . y - img . Sprite ( ) - > height / 2 - 2 ;
@ -552,7 +552,7 @@ void Unit::_DrawHud(TileTransformedView&game,std::map<Image,Renderable>&IMAGES){
}
}
void Unit : : DrawUnitDamageStats ( PixelGameEngine * pge , TileTransformedView & game , std : : map < Image , Renderable > & IMAGES ) {
void Unit : : DrawUnitDamageStats ( PixelGameEngine * pge , TileTransformedView & game , std : : vector < Renderable > & IMAGES ) {
if ( ! target . expired ( ) ) {
geom2d : : line < float > lineToTarget ( pos , target . lock ( ) - > pos ) ;
lineToTarget . start = lineToTarget . rpoint ( GetUnitSize ( ) . x / 2 ) ;
@ -652,7 +652,7 @@ void Unit::_RunAI(PixelGameEngine*pge){
RunAI ( pge ) ;
}
void Unit : : _Update ( PixelGameEngine * pge , std : : map < Sound , std : : unique_ptr < Audio > > & SOUNDS , Resources & player_resources , Resources & enemy_resources , std : : vector < std : : unique_ptr < Unit > > & queuedUnits , std : : array < float , 5 > & resourceGainTimer , std : : vector < ResourceGainIcon > & resourceGainIcons , std : : map < Image , Renderable > & IMAGES ) {
void Unit : : _Update ( PixelGameEngine * pge , std : : map < Sound , std : : unique_ptr < Audio > > & SOUNDS , Resources & player_resources , Resources & enemy_resources , std : : vector < std : : unique_ptr < Unit > > & queuedUnits , std : : array < float , 5 > & resourceGainTimer , std : : vector < ResourceGainIcon > & resourceGainIcons , std : : vector < Renderable > & IMAGES ) {
if ( ! target . expired ( ) ) {
auto ptrTarget = target . lock ( ) ;
if ( ! InRange ( ptrTarget ) & & CanMove ( ) ) {
@ -801,7 +801,7 @@ void Unit::SetPos(vf2d newPos){
pos = newPos ;
}
void Unit : : AttemptAttack ( std : : weak_ptr < Unit > attacker , std : : weak_ptr < Unit > unit , std : : vector < std : : shared_ptr < Unit > > & otherUnits , std : : vector < DebuffIcon > & debuffIcons , std : : map < Image , Renderable > & IMAGES ) {
void Unit : : AttemptAttack ( std : : weak_ptr < Unit > attacker , std : : weak_ptr < Unit > unit , std : : vector < std : : shared_ptr < Unit > > & otherUnits , std : : vector < DebuffIcon > & debuffIcons , std : : vector < Renderable > & IMAGES ) {
if ( reloadTimer > 0 ) return ;
std : : weak_ptr < Unit > finalTarget ;
if ( ! unit . expired ( ) ) {
@ -944,7 +944,7 @@ Pixel Unit::GetUnitColor(){
}
}
bool Unit : : ClickHandled ( TileTransformedView & game , Resources & player_resources , std : : vector < std : : shared_ptr < Unit > > & units , std : : map < Image , Renderable > & IMAGES ) {
bool Unit : : ClickHandled ( TileTransformedView & game , Resources & player_resources , std : : vector < std : : shared_ptr < Unit > > & units , std : : vector < Renderable > & IMAGES ) {
return false ;
} ;