Corrected ability usage

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent 765725de0d
commit ffdc088e24
  1. 79
      SeasonsOfLoneliness.cpp
  2. BIN
      Seasons_of_Loneliness
  3. 2
      assets/maps/map1

@ -76,6 +76,7 @@ namespace cutscene{
IN_BED,
SHAKE,
INVESTIGATE_X_X,
CHECK_COORDS,
};
}
@ -106,6 +107,8 @@ namespace gameflag{
ANALYSIS_X_X,
TUTORIAL1_X_X,
TUTORIAL2_X_X,
CHECK_ROVER,
NEXT_COORDS,
};
}
@ -308,6 +311,7 @@ class WEATHER_POWER{
bool burnTrees=false; //If set to true, will trigger a burning of trees.
float treeBurnChance=1; //% chance of trees getting burned by this attack.
float treeSeedChance=0; //% chance of trees producing seeds from this attack.
bool lowPriority=false; //Will always go last if set to true.
WEATHER_POWER(std::string name,std::string desc,Animation*icon,Animation*effect,int dmg,int dmgRoll,int range,Pixel bgcol,Pixel textcol,int effectTime,ParticleEffect*parteff) {
this->description=desc;
this->name=name;
@ -824,6 +828,8 @@ public:
FIRESTORM->treeBurnChance=1;
FIRESTORM->burnTrees=true;
LIGHT_STORM->lowPriority=true;
MOVESET_SPIDEY.push_back(SANDSTORM);
MOVESET_SPIDEY.push_back(SEED_STORM);
MOVESET_SPIDEY.push_back(AVALANCHE);
@ -1064,7 +1070,7 @@ public:
}
}
} else
if (IN_BATTLE_ENCOUNTER) {
if (IN_BATTLE_ENCOUNTER&&!messageBoxVisible) {
switch (BATTLE_STATE) {
case battle::PLAYER_SELECTION:{
if (GetKey(D).bPressed||GetKey(RIGHT).bPressed||GetKey(NP6).bPressed) {
@ -1225,6 +1231,16 @@ public:
GAME_STATE=LATER_THAT_NIGHTFADEIN;
fadeOutCompleted();
}
if (GAME_FLAGS[gameflag::REST_IN_DOME]&&!GAME_FLAGS[gameflag::SLEEP]) {
GAME_FLAGS[gameflag::SLEEP]=true;
//20,2
GAME_STATE=LATER_THAT_NIGHTFADEIN;
fadeOutCompleted();
}
if (!GAME_FLAGS[gameflag::CHECK_ROVER]&&GAME_FLAGS[gameflag::TUTORIAL2_X_X]) {
GAME_FLAGS[gameflag::CHECK_ROVER]=true;
DisplayMessageBox(26);
}
}break;
case cutscene::DISPLAY_VOLCANIC_AREA:{
TeleportToMapFileCoords(13,122);
@ -1665,11 +1681,33 @@ public:
case battle::PLAYER_SELECTION:{
if (!GAME_FLAGS[gameflag::TUTORIAL1_X_X]&&GAME_FLAGS[gameflag::ANALYSIS_X_X]) {
GAME_FLAGS[gameflag::TUTORIAL1_X_X]=true;
DisplayMessageBox(24);
bool hasPetalStorm=false;
for (int i=0;i<availablePowers.size();i++) {
if (availablePowers[i]->name.compare("Petal Storm")==0) {
BATTLE_CARD_SELECTION=availablePowers[i];
BATTLE_CARD_SELECTION_IND=i;
hasPetalStorm=true;
break;
}
}
if (hasPetalStorm) {
DisplayMessageBox(24);
}
} else
if (!GAME_FLAGS[gameflag::TUTORIAL2_X_X]&&GAME_FLAGS[gameflag::TUTORIAL1_X_X]) {
GAME_FLAGS[gameflag::TUTORIAL2_X_X]=true;
DisplayMessageBox(25);
bool hasPetalStorm=false;
for (int i=0;i<availablePowers.size();i++) {
if (availablePowers[i]->name.compare("Petal Storm")==0) {
BATTLE_CARD_SELECTION=availablePowers[i];
BATTLE_CARD_SELECTION_IND=i;
hasPetalStorm=true;
break;
}
}
if (hasPetalStorm) {
DisplayMessageBox(25);
}
}
}break;
case battle::WAIT_TURN_ANIMATION:{
@ -1703,14 +1741,16 @@ public:
if (BATTLE_CURRENT_TURN_ENTITY==-1) {
effectRadius({(int)BATTLE_PLAYER_COORDS.x,(int)BATTLE_PLAYER_COORDS.y},ref,-healRoll,true);
} else {
effectRadius({CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->x+CURRENT_ENCOUNTER.x,CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->y+CURRENT_ENCOUNTER.y},ref,-healRoll,false);
effectRadius({CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->x+CURRENT_ENCOUNTER.x+CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->spr->sprite->width*CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->sprScale.x/2/32,CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->y+CURRENT_ENCOUNTER.y+CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->spr->sprite->height*CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->sprScale.y/2/32},ref,-healRoll,false);
}
}
if (EFFECT_TIMER==30&&ref->name.compare("Seed Storm")==0) {
if (EFFECT_TIMER==30&&(
ref->name.compare("Seed of Life")==0||
ref->name.compare("Seed Storm")==0)) {
if (BATTLE_CURRENT_TURN_ENTITY==-1) {
effectRadius({(int)BATTLE_PLAYER_COORDS.x,(int)BATTLE_PLAYER_COORDS.y},ref,true);
} else {
effectRadius({CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->x+CURRENT_ENCOUNTER.x,CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->y+CURRENT_ENCOUNTER.y},ref,false);
effectRadius({CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->x+CURRENT_ENCOUNTER.x+CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->spr->sprite->width*CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->sprScale.x/2/32,CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->y+CURRENT_ENCOUNTER.y+CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->spr->sprite->height*CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->sprScale.y/2/32},ref,false);
}
} else
if (EFFECT_TIMER==ref->effectTime-10){
@ -1724,7 +1764,7 @@ public:
if (PLAYER_SELECTED_TARGET==-2) {
effectRadius({CURRENT_ENCOUNTER.x+CURRENT_ENCOUNTER.playerX,CURRENT_ENCOUNTER.y+CURRENT_ENCOUNTER.playerY},ref,true);
} else {
effectRadius({CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->x+CURRENT_ENCOUNTER.x,CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->y+CURRENT_ENCOUNTER.y},ref,true); }
effectRadius({CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->x+CURRENT_ENCOUNTER.x+CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->spr->sprite->width*CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->sprScale.x/2/32,CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->y+CURRENT_ENCOUNTER.y+CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->spr->sprite->height*CURRENT_ENCOUNTER.entities[PLAYER_SELECTED_TARGET]->sprScale.y/2/32},ref,true); }
} else {
effectRadius({CURRENT_ENCOUNTER.x+CURRENT_ENCOUNTER.playerX,CURRENT_ENCOUNTER.y+CURRENT_ENCOUNTER.playerY},ref,false);
if (ref==LIGHT_STORM&&CURRENT_ENCOUNTER.entities[BATTLE_CURRENT_TURN_ENTITY]->name.compare("X_X")==0) {
@ -2103,6 +2143,16 @@ public:
}
}
}break;
case cutscene::CHECK_COORDS:{
if (!messageBoxVisible) {
if (!CUTSCENE_FLAGS[0]) {
CUTSCENE_FLAGS[0]=true;
DisplayMessageBox(28);
} else {
EndCutscene();
}
}
}break;
}
if (GAME_STATE==CUTSCENE_3&&!SOUND_IS_PLAYING) {
@ -2249,6 +2299,12 @@ public:
if (!GAME_FLAGS[gameflag::REPAIRED_ROVER_1]&&GAME_FLAGS[gameflag::COLLECTED_SILICON_1]&&PLAYER_COORDS[0]>=31&&PLAYER_COORDS[0]<=35&&PLAYER_COORDS[1]>=33&&PLAYER_COORDS[1]<=37) {
GAME_FLAGS[gameflag::REPAIRED_ROVER_1]=true;
PlayCutscene(cutscene::REPAIR_ROVER_1);
} else
if (!GAME_FLAGS[gameflag::NEXT_COORDS]&&GAME_FLAGS[gameflag::CHECK_ROVER]&&PLAYER_COORDS[0]>=31&&PLAYER_COORDS[0]<=35&&PLAYER_COORDS[1]>=33&&PLAYER_COORDS[1]<=37) {
GAME_FLAGS[gameflag::NEXT_COORDS]=true;
DisplayMessageBox(27);
StartCutscene(cutscene::CHECK_COORDS);
CUTSCENE_OBJS[0]=CreateObject({PLAYER_COORDS[0],PLAYER_COORDS[1]},PLAYER_DECAL,playerAnim,true);
}
}
@ -2814,7 +2870,8 @@ public:
for (int i=0;i<CURRENT_ENCOUNTER.entities.size();i++) {
finalDamage=power->damage+rand()%power->damageRoll*sign(power->damage);
Entity*ent=CURRENT_ENCOUNTER.entities[i];
if (distancetoCoords({(float)((ent->x+CURRENT_ENCOUNTER.x)*32)+ent->spr->sprite->width/2,(float)((ent->y+CURRENT_ENCOUNTER.y)*32)+ent->spr->sprite->height/2},coords*32)<=power->range) {
std::cout<<"Distance is "<<distancetoCoords({(float)((ent->x+CURRENT_ENCOUNTER.x)*32)+ent->spr->sprite->width*ent->sprScale.x/2,(float)((ent->y+CURRENT_ENCOUNTER.y)*32)+ent->spr->sprite->height*ent->sprScale.y/2},coords*32)<<"m.\n";
if (distancetoCoords({(float)((ent->x+CURRENT_ENCOUNTER.x)*32)+ent->spr->sprite->width*ent->sprScale.x/2,(float)((ent->y+CURRENT_ENCOUNTER.y)*32)+ent->spr->sprite->height*ent->sprScale.y/2},coords*32)<=power->range) {
ent->hp=std::clamp(ent->hp-finalDamage,0,ent->maxhp);
CreateDisplayNumber(finalDamage,ent->x+CURRENT_ENCOUNTER.x+ent->spr->sprite->width*ent->sprScale.x/2/32,ent->y+CURRENT_ENCOUNTER.y+ent->spr->sprite->height*ent->sprScale.y/2/32,frameCount);
ent->damageFrame=frameCount;
@ -2827,8 +2884,8 @@ public:
for (int i=0;i<CURRENT_ENCOUNTER.entities.size();i++) {
finalDamage=power->damage+rand()%power->damageRoll*sign(power->damage);
Entity*ent=CURRENT_ENCOUNTER.entities[i];
std::cout<<"Distance was "<<distancetoCoords({(float)((ent->x+CURRENT_ENCOUNTER.x)*32),(float)((ent->y+CURRENT_ENCOUNTER.y)*32)},coords*32)<<"\n";
if (ent->hp>0&&distancetoCoords({(float)((ent->x+CURRENT_ENCOUNTER.x)*32)+ent->spr->sprite->width/2,(float)((ent->y+CURRENT_ENCOUNTER.y)*32)+ent->spr->sprite->height/2},coords*32)<=power->range) {
//std::cout<<"Distance was "<<distancetoCoords({(float)((ent->x+CURRENT_ENCOUNTER.x)*32),(float)((ent->y+CURRENT_ENCOUNTER.y)*32)},coords*32)<<"\n";
if (ent->hp>0&&distancetoCoords({(float)((ent->x+CURRENT_ENCOUNTER.x)*32)+ent->spr->sprite->width*ent->sprScale.x/2,(float)((ent->y+CURRENT_ENCOUNTER.y)*32)+ent->spr->sprite->height*ent->sprScale.y/2},coords*32)<=power->range) {
ent->hp=std::clamp(ent->hp-finalDamage,0,ent->maxhp);
CreateDisplayNumber(finalDamage,ent->x+CURRENT_ENCOUNTER.x+ent->spr->sprite->width*ent->sprScale.x/2/32,ent->y+CURRENT_ENCOUNTER.y+ent->spr->sprite->height*ent->sprScale.y/2/32,frameCount);
ent->damageFrame=frameCount;
@ -2911,7 +2968,7 @@ public:
PLAYER_TURN_COMPLETE=true;
}
if (ent->hp>0&&!ent->turnComplete&&
!ent->slowed&&rand()%2==0) {
!ent->slowed&&rand()%2==0&&!ent->selectedMove->lowPriority) {
turnOrder.push(i);
ent->turnComplete=true;
}

Binary file not shown.

@ -85,8 +85,6 @@
202;33;METEORSTORM_NODE
167;44;SNOWSTORM_NODE
20;10;HURRICANE_NODE
39;38;SOLARFLARE_NODE
38;38;FIRESTORM_NODE
33;35;BROKEN_ROVER
116;8;NADO
120;9;NADO

Loading…
Cancel
Save