@ -97,7 +97,9 @@ class WEATHER_POWER{
int damageRoll ;
int range ;
int playerOwnCount ;
WEATHER_POWER ( std : : string name , std : : string desc , Animation * icon , Animation * effect , int dmg , int dmgRoll , int range ) {
Pixel bgcol ;
Pixel textcol ;
WEATHER_POWER ( std : : string name , std : : string desc , Animation * icon , Animation * effect , int dmg , int dmgRoll , int range , Pixel bgcol , Pixel textcol ) {
this - > description = desc ;
this - > name = name ;
this - > anim = icon ;
@ -105,6 +107,8 @@ class WEATHER_POWER{
this - > damage = dmg ;
this - > damageRoll = dmgRoll ;
this - > range = range ;
this - > bgcol = bgcol ;
this - > textcol = textcol ;
}
} ;
@ -199,14 +203,14 @@ public:
Animation POWER_METEOR_STORM_ANIMATION ;
Animation POWER_SNOWSTORM_ANIMATION ;
std : : vector < Entity > entityList ;
WEATHER_POWER * HAILSTORM = new WEATHER_POWER ( " Hailstorm " , " Causes a flurry of hard cold rocks to be unleashed in target area. 60+30d " , & POWER_HAILSTORM_ANIMATION , & POWER_HAILSTORM_ANIMATION , 60 , 30 , 160 ) ;
WEATHER_POWER * HURRICANE = new WEATHER_POWER ( " Hurricane " , " Causes heavy winds, scattering seeds, heavy rain. 20+10d " , & POWER_HURRICANE_ANIMATION , & POWER_HURRICANE_ANIMATION , 20 , 10 , 200 ) ;
WEATHER_POWER * METEOR_SHOWE R = new WEATHER_POWER ( " Meteor Shower " , " Causes space rocks to fall on target area. 50+50d " , & POWER_METEOR_SHOWER_ANIMATION , & POWER_METEOR_SHOWER_ANIMATION , 50 , 50 , 96 ) ;
WEATHER_POWER * METEOR_STORM = new WEATHER_POWER ( " Meteor Storm " , " Larger space rocks. 120+60d " , & POWER_METEOR_STORM_ANIMATION , & POWER_METEOR_STORM_ANIMATION , 120 , 60 , 140 ) ;
WEATHER_POWER * SNOWSTORM = new WEATHER_POWER ( " Snowstorm " , " Slows down targets and causes rapid temperature drops. 15+10d " , & POWER_SNOWSTORM_ANIMATION , & POWER_SNOWSTORM_ANIMATION , 15 , 10 , 140 ) ;
WEATHER_POWER * SANDSTORM = new WEATHER_POWER ( " Sandstorm " , " " , & POWER_HAILSTORM_ANIMATION , & POWER_HAILSTORM_ANIMATION , 5 , 10 , 64 ) ;
WEATHER_POWER * PETAL_BLOSSOM = new WEATHER_POWER ( " Petal Blossom " , " " , & POWER_HAILSTORM_ANIMATION , & POWER_HAILSTORM_ANIMATION , 8 , 20 , 164 ) ;
WEATHER_POWER * AVALANCHE = new WEATHER_POWER ( " Avalanche " , " " , & POWER_HAILSTORM_ANIMATION , & POWER_HAILSTORM_ANIMATION , 15 , 10 , 200 ) ;
WEATHER_POWER * HAILSTORM = new WEATHER_POWER ( " Hailstorm " , " Causes a flurry of hard cold rocks to be unleashed in target area. 60+30d " , & POWER_HAILSTORM_ANIMATION , & POWER_HAILSTORM_ANIMATION , 60 , 30 , 160 , Pixel ( 72 , 160 , 212 , 255 ) , Pixel ( 93 , 161 , 163 , 255 ) ) ;
WEATHER_POWER * HURRICANE = new WEATHER_POWER ( " Hurricane " , " Causes heavy winds, scattering seeds, heavy rain. 20+10d " , & POWER_HURRICANE_ANIMATION , & POWER_HURRICANE_ANIMATION , 20 , 10 , 200 , Pixel ( 99 , 148 , 132 , 255 ) , Pixel ( 121 , 132 , 140 , 255 ) ) ;
WEATHER_POWER * METEOR_RAIN = new WEATHER_POWER ( " Meteor Rain " , " Causes space rocks to fall on target area. 50+50d " , & POWER_METEOR_SHOWER_ANIMATION , & POWER_METEOR_SHOWER_ANIMATION , 50 , 50 , 96 , Pixel ( 96 , 86 , 153 , 255 ) , Pixel ( 170 , 103 , 201 , 255 ) ) ;
WEATHER_POWER * METEOR_STORM = new WEATHER_POWER ( " Meteor Storm " , " Larger space rocks. 120+60d " , & POWER_METEOR_STORM_ANIMATION , & POWER_METEOR_STORM_ANIMATION , 120 , 60 , 140 , Pixel ( 89 , 4 , 33 , 255 ) , Pixel ( 130 , 56 , 1 , 255 ) ) ;
WEATHER_POWER * SNOWSTORM = new WEATHER_POWER ( " Snowstorm " , " Slows down targets and causes rapid temperature drops. 15+10d " , & POWER_SNOWSTORM_ANIMATION , & POWER_SNOWSTORM_ANIMATION , 15 , 10 , 140 , Pixel ( 183 , 196 , 194 , 255 ) , Pixel ( 222 , 255 , 254 , 255 ) ) ;
WEATHER_POWER * SANDSTORM = new WEATHER_POWER ( " Sandstorm " , " " , & POWER_HAILSTORM_ANIMATION , & POWER_HAILSTORM_ANIMATION , 5 , 10 , 64 , Pixel ( 93 , 161 , 163 , 255 ) , Pixel ( 72 , 160 , 212 , 255 ) ) ;
WEATHER_POWER * PETAL_BLOSSOM = new WEATHER_POWER ( " Petal Blossom " , " " , & POWER_HAILSTORM_ANIMATION , & POWER_HAILSTORM_ANIMATION , 8 , 20 , 164 , Pixel ( 93 , 161 , 163 , 255 ) , Pixel ( 72 , 160 , 212 , 255 ) ) ;
WEATHER_POWER * AVALANCHE = new WEATHER_POWER ( " Avalanche " , " " , & POWER_HAILSTORM_ANIMATION , & POWER_HAILSTORM_ANIMATION , 15 , 10 , 200 , Pixel ( 93 , 161 , 163 , 255 ) , Pixel ( 72 , 160 , 212 , 255 ) ) ;
bool IN_BATTLE_ENCOUNTER = false ;
int BATTLE_ENTRY_TIMER = 0 ;
int EFFECT_TIMER = 0 ;
@ -214,12 +218,13 @@ public:
WEATHER_POWER * WEATHER_POWERS [ WEATHER_POWER_COUNT ] = {
HAILSTORM ,
HURRICANE ,
METEOR_SHOWE R ,
METEOR_RAIN ,
METEOR_STORM ,
SNOWSTORM , } ;
battle : : BATTLESTATE BATTLE_STATE = battle : : NONE ;
std : : vector < WEATHER_POWER * > availablePowers ;
WEATHER_POWER * BATTLE_CARD_SELECTION = HAILSTORM ;
int BATTLE_CARD_SELECTION_IND = 0 ;
Decal * DOME_DECAL , * FOOD_METER_DECAL , * OXYGEN_METER_DECAL , * PLANT_DECAL ,
@ -319,7 +324,7 @@ public:
HAILSTORM - > playerOwnCount = 3 ;
HURRICANE - > playerOwnCount = 1 ;
METEOR_SHOWE R - > playerOwnCount = 5 ;
METEOR_RAIN - > playerOwnCount = 5 ;
ENCOUNTER_SPIDEY_1 . entities . push_back ( * new Entity ( SPIDEY_DECAL , " Spidey " , 2 , 3 , 80 , 80 , false ) ) ;
ENCOUNTER_SPIDEY_1 . entities . push_back ( * new Entity ( SPIDEY_DECAL , " Spidey " , 4 , 4 , 80 , 80 , false ) ) ;
@ -387,33 +392,51 @@ public:
if ( GetKey ( F1 ) . bPressed ) {
ConsoleShow ( F1 , false ) ;
}
if ( GetKey ( D ) . bPressed | | GetKey ( RIGHT ) . bPressed | | GetKey ( NP6 ) . bPressed ) {
changeAnimation ( playerAnimWalkRight ) ;
}
if ( GetKey ( A ) . bPressed | | GetKey ( LEFT ) . bPressed | | GetKey ( NP4 ) . bPressed ) {
changeAnimation ( playerAnimWalkLeft ) ;
}
if ( GetKey ( W ) . bPressed | | GetKey ( UP ) . bPressed | | GetKey ( NP8 ) . bPressed ) {
changeAnimation ( playerAnimWalkUp ) ;
}
if ( GetKey ( S ) . bPressed | | GetKey ( DOWN ) . bPressed | | GetKey ( NP5 ) . bPressed | | GetKey ( NP2 ) . bPressed ) {
changeAnimation ( playerAnimWalkDown ) ;
}
if ( ! GetKey ( D ) . bHeld & & ! GetKey ( RIGHT ) . bHeld & & ! GetKey ( NP6 ) . bHeld & &
! GetKey ( A ) . bHeld & & ! GetKey ( LEFT ) . bHeld & & ! GetKey ( NP4 ) . bHeld & &
! GetKey ( S ) . bHeld & & ! GetKey ( UP ) . bHeld & & ! GetKey ( NP8 ) . bHeld & &
! GetKey ( W ) . bHeld & & ! GetKey ( DOWN ) . bHeld & & ! GetKey ( NP5 ) . bHeld & & ! GetKey ( NP2 ) . bHeld ) {
if ( GetKey ( D ) . bReleased | | GetKey ( RIGHT ) . bReleased | | GetKey ( NP6 ) . bReleased ) {
changeAnimation ( playerAnimRight ) ;
if ( playerCanMove ( ) ) {
if ( GetKey ( D ) . bPressed | | GetKey ( RIGHT ) . bPressed | | GetKey ( NP6 ) . bPressed ) {
changeAnimation ( playerAnimWalkRight ) ;
}
if ( GetKey ( A ) . bPressed | | GetKey ( LEFT ) . bPressed | | GetKey ( NP4 ) . bPressed ) {
changeAnimation ( playerAnimWalkLeft ) ;
}
if ( GetKey ( A ) . bRelea sed| | GetKey ( LEFT ) . bRelea sed| | GetKey ( NP4 ) . bRelea sed ) {
changeAnimation ( playerAnimLeft ) ;
if ( GetKey ( W ) . bPressed | | GetKey ( UP ) . bPressed | | GetKey ( NP8 ) . bPressed ) {
changeAnimation ( playerAnimWalkUp ) ;
}
if ( GetKey ( W ) . bRelea sed| | GetKey ( UP ) . bRelea sed| | GetKey ( NP8 ) . bRelea sed ) {
changeAnimation ( playerAnim ) ;
if ( GetKey ( S ) . bPressed | | GetKey ( DOWN ) . bPressed | | GetKey ( NP5 ) . bPressed | | GetKey ( NP2 ) . bPressed ) {
changeAnimation ( playerAnimWalkDown ) ;
}
if ( GetKey ( S ) . bReleased | | GetKey ( DOWN ) . bReleased | | GetKey ( NP5 ) . bReleased | | GetKey ( NP2 ) . bReleased ) {
changeAnimation ( playerAnimDown ) ;
if ( ! GetKey ( D ) . bHeld & & ! GetKey ( RIGHT ) . bHeld & & ! GetKey ( NP6 ) . bHeld & &
! GetKey ( A ) . bHeld & & ! GetKey ( LEFT ) . bHeld & & ! GetKey ( NP4 ) . bHeld & &
! GetKey ( S ) . bHeld & & ! GetKey ( UP ) . bHeld & & ! GetKey ( NP8 ) . bHeld & &
! GetKey ( W ) . bHeld & & ! GetKey ( DOWN ) . bHeld & & ! GetKey ( NP5 ) . bHeld & & ! GetKey ( NP2 ) . bHeld ) {
if ( GetKey ( D ) . bReleased | | GetKey ( RIGHT ) . bReleased | | GetKey ( NP6 ) . bReleased ) {
changeAnimation ( playerAnimRight ) ;
}
if ( GetKey ( A ) . bReleased | | GetKey ( LEFT ) . bReleased | | GetKey ( NP4 ) . bReleased ) {
changeAnimation ( playerAnimLeft ) ;
}
if ( GetKey ( W ) . bReleased | | GetKey ( UP ) . bReleased | | GetKey ( NP8 ) . bReleased ) {
changeAnimation ( playerAnim ) ;
}
if ( GetKey ( S ) . bReleased | | GetKey ( DOWN ) . bReleased | | GetKey ( NP5 ) . bReleased | | GetKey ( NP2 ) . bReleased ) {
changeAnimation ( playerAnimDown ) ;
}
}
} else
if ( IN_BATTLE_ENCOUNTER ) {
switch ( BATTLE_STATE ) {
case battle : : PLAYER_SELECTION : {
if ( GetKey ( D ) . bPressed | | GetKey ( RIGHT ) . bPressed | | GetKey ( NP6 ) . bPressed ) {
BATTLE_CARD_SELECTION_IND = ( BATTLE_CARD_SELECTION_IND + 1 ) % availablePowers . size ( ) ;
BATTLE_CARD_SELECTION = availablePowers [ BATTLE_CARD_SELECTION_IND ] ;
}
if ( GetKey ( A ) . bPressed | | GetKey ( LEFT ) . bPressed | | GetKey ( NP4 ) . bPressed ) {
if ( - - BATTLE_CARD_SELECTION_IND < 0 ) {
BATTLE_CARD_SELECTION_IND = availablePowers . size ( ) - 1 ;
}
BATTLE_CARD_SELECTION = availablePowers [ BATTLE_CARD_SELECTION_IND ] ;
}
} break ;
}
}
@ -506,7 +529,7 @@ public:
}
}
if ( CURRENT_CUTSCENE = = NONE & & ! messageBoxVisible & & ! IN_BATTLE_ENCOUNTER ) {
if ( playerCanMove ( ) ) {
bool changed = false ;
if ( GetKey ( D ) . bHeld | | GetKey ( RIGHT ) . bHeld | | GetKey ( NP6 ) . bHeld ) {
PLAYER_COORDS [ 0 ] = std : : clamp ( PLAYER_COORDS [ 0 ] + MOVE_SPD , 0.1 , ( double ) MAP_WIDTH ) ;
@ -562,7 +585,7 @@ public:
} else
if ( obj . name . compare ( " METEORSHOWER_NODE " ) = = 0 & & collidesWithPlayer ( obj ) ) {
int amountGained = rand ( ) % 4 + 2 ;
METEOR_SHOWE R - > playerOwnCount + = amountGained ;
METEOR_RAIN - > playerOwnCount + = amountGained ;
std : : cout < < " Increased METEORSHOWER power inventory count by " < < amountGained < < " . \n " ;
OBJECTS . erase ( OBJECTS . begin ( ) + i - - ) ;
} else
@ -599,7 +622,8 @@ public:
//cout<<"There are x"<<WEATHER_POWERS[i]->playerOwnCount<<" of "<<WEATHER_POWERS[i]->name<<"\n";
}
}
BATTLE_CARD_SELECTION = availablePowers [ 0 ] ;
BATTLE_CARD_SELECTION_IND = 0 ;
BATTLE_CARD_SELECTION = availablePowers [ BATTLE_CARD_SELECTION_IND ] ;
}
}
}
@ -813,10 +837,10 @@ public:
}
switch ( BATTLE_STATE ) {
case battle : : PLAYER_SELECTION : {
GradientFillRectDecal ( { WIDTH / 6 , HEIGHT / 6 } , { WIDTH / 3 , HEIGHT / 6 * 2 } , Pixel ( 72 , 160 , 212 , 255 ) , Pixel ( 72 , 160 , 212 , 255 ) , Pixel ( 72 , 160 , 212 , 0 ) , Pixel ( 72 , 160 , 212 , 255 ) ) ;
GradientFillRectDecal ( { WIDTH / 6 * 3 + 1 , HEIGHT / 6 } , { WIDTH / 3 , HEIGHT / 6 * 2 } , Pixel ( 72 , 160 , 212 , 255 ) , Pixel ( 72 , 160 , 212 , 0 ) , Pixel ( 72 , 160 , 212 , 255 ) , Pixel ( 72 , 160 , 212 , 255 ) ) ;
GradientFillRectDecal ( { WIDTH / 6 , HEIGHT / 6 * 3 } , { WIDTH / 3 , HEIGHT / 6 * 2 } , Pixel ( 72 , 160 , 212 , 255 ) , Pixel ( 72 , 160 , 212 , 255 ) , Pixel ( 72 , 160 , 212 , 255 ) , Pixel ( 72 , 160 , 212 , 0 ) ) ;
GradientFillRectDecal ( { WIDTH / 6 * 3 + 1 , HEIGHT / 6 * 3 } , { WIDTH / 3 , HEIGHT / 6 * 2 } , Pixel ( 72 , 160 , 212 , 0 ) , Pixel ( 72 , 160 , 212 , 255 ) , Pixel ( 72 , 160 , 212 , 255 ) , Pixel ( 72 , 160 , 212 , 255 ) ) ;
GradientFillRectDecal ( { WIDTH / 6 , HEIGHT / 6 } , { WIDTH / 3 , HEIGHT / 6 * 2 } , BATTLE_CARD_SELECTION - > bgcol , BATTLE_CARD_SELECTION - > bgcol , Pixel ( 72 , 160 , 212 , 0 ) , BATTLE_CARD_SELECTION - > bgcol ) ;
GradientFillRectDecal ( { WIDTH / 6 * 3 + 1 , HEIGHT / 6 } , { WIDTH / 3 , HEIGHT / 6 * 2 } , BATTLE_CARD_SELECTION - > bgcol , Pixel ( 72 , 160 , 212 , 0 ) , BATTLE_CARD_SELECTION - > bgcol , BATTLE_CARD_SELECTION - > bgcol ) ;
GradientFillRectDecal ( { WIDTH / 6 , HEIGHT / 6 * 3 } , { WIDTH / 3 , HEIGHT / 6 * 2 } , BATTLE_CARD_SELECTION - > bgcol , BATTLE_CARD_SELECTION - > bgcol , BATTLE_CARD_SELECTION - > bgcol , Pixel ( 72 , 160 , 212 , 0 ) ) ;
GradientFillRectDecal ( { WIDTH / 6 * 3 + 1 , HEIGHT / 6 * 3 } , { WIDTH / 3 , HEIGHT / 6 * 2 } , Pixel ( 72 , 160 , 212 , 0 ) , BATTLE_CARD_SELECTION - > bgcol , BATTLE_CARD_SELECTION - > bgcol , BATTLE_CARD_SELECTION - > bgcol ) ;
DrawPartialDecal ( { WIDTH / 2 - BATTLE_CARD_SELECTION - > anim - > width / 2 * 3 , HEIGHT / 6 + 16 - BATTLE_CARD_SELECTION - > anim - > height / 2 } , BATTLE_CARD_SELECTION - > anim - > spr , BATTLE_CARD_SELECTION - > anim - > getCurrentFrame ( ) , { BATTLE_CARD_SELECTION - > anim - > width , BATTLE_CARD_SELECTION - > anim - > height } , { 3 , 3 } ) ;
for ( int x = - 1 ; x < = 1 ; x + + ) {
for ( int y = - 1 ; y < = 1 ; y + + ) {
@ -825,7 +849,7 @@ public:
}
}
}
DrawStringPropDecal ( { WIDTH / 6 + 4 , HEIGHT / 2 + 8 } , BATTLE_CARD_SELECTION - > name , Pixel ( 93 , 161 , 163 , 255 ) , { 2 , 2 } ) ;
DrawStringPropDecal ( { WIDTH / 6 + 4 , HEIGHT / 2 + 8 } , BATTLE_CARD_SELECTION - > name , BATTLE_CARD_SELECTION - > textcol , { 2 , 2 } ) ;
DrawWrappedPropText ( { WIDTH / 6 + 4 + 1 , HEIGHT / 2 + 24 + 1 } , BATTLE_CARD_SELECTION - > description , WIDTH / 3 * 2 - 8 , BLACK , { 1 , 1 } ) ;
DrawWrappedPropText ( { WIDTH / 6 + 4 , HEIGHT / 2 + 24 } , BATTLE_CARD_SELECTION - > description , WIDTH / 3 * 2 - 8 , Pixel ( 227 , 245 , 255 , 255 ) , { 1 , 1 } ) ;
for ( int x = - 1 ; x < = 1 ; x + + ) {
@ -1056,6 +1080,10 @@ public:
}
DrawStringPropDecal ( pos , wrappedText , col , scale ) ;
}
bool playerCanMove ( ) {
return CURRENT_CUTSCENE = = NONE & & ! messageBoxVisible & & ! IN_BATTLE_ENCOUNTER ;
}
} ;