generated from sigonasr2/CPlusPlusProjectTemplate
Add in hidden buff effects
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
f2e6a46bb8
commit
645bcfbb2d
@ -2985,6 +2985,7 @@ public:
|
|||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
f.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void changeAnimation(Animation*anim) {
|
void changeAnimation(Animation*anim) {
|
||||||
@ -3116,7 +3117,7 @@ public:
|
|||||||
finalDamage=power->damage+rand()%power->damageRoll*sign(power->damage);
|
finalDamage=power->damage+rand()%power->damageRoll*sign(power->damage);
|
||||||
Entity*ent=CURRENT_ENCOUNTER.entities[i];
|
Entity*ent=CURRENT_ENCOUNTER.entities[i];
|
||||||
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";
|
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) {
|
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->hidden) {
|
||||||
ent->hp=std::clamp(ent->hp-finalDamage,0,ent->maxhp);
|
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);
|
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;
|
ent->damageFrame=frameCount;
|
||||||
@ -3130,7 +3131,7 @@ public:
|
|||||||
finalDamage=power->damage+rand()%power->damageRoll*sign(power->damage);
|
finalDamage=power->damage+rand()%power->damageRoll*sign(power->damage);
|
||||||
Entity*ent=CURRENT_ENCOUNTER.entities[i];
|
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";
|
//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) {
|
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->hidden) {
|
||||||
ent->hp=std::clamp(ent->hp-finalDamage,0,ent->maxhp);
|
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);
|
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;
|
ent->damageFrame=frameCount;
|
||||||
@ -3543,11 +3544,18 @@ public:
|
|||||||
|
|
||||||
void DrawBuffs(vf2d pos,Entity*ent) {
|
void DrawBuffs(vf2d pos,Entity*ent) {
|
||||||
if (ent!=NULL) {
|
if (ent!=NULL) {
|
||||||
|
vi2d buffPos={0,0};
|
||||||
if (ent->speed==-1) {
|
if (ent->speed==-1) {
|
||||||
DrawDecal(pos,SLOWED_DECAL);
|
DrawDecal(pos+buffPos,SLOWED_DECAL);
|
||||||
|
buffPos.x+=16;
|
||||||
} else
|
} else
|
||||||
if (ent->speed==1) {
|
if (ent->speed==1) {
|
||||||
DrawDecal(pos,SPEED_DECAL);
|
DrawDecal(pos+buffPos,SPEED_DECAL);
|
||||||
|
buffPos.x+=16;
|
||||||
|
}
|
||||||
|
if (ent->hidden) {
|
||||||
|
DrawDecal(pos+buffPos,HIDDEN_DECAL);
|
||||||
|
buffPos.x+=16;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//Draw Player's Buffs.
|
//Draw Player's Buffs.
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user