Make bomb explosion sizes be calculated independent of initial bomb size. Shrink down bomb size to be more reasonable. Bombs knock back players and monsters, regardless of the friendly flag. Only deals damage to opposing targets. Release Build 9237.

This commit is contained in:
sigonasr2 2024-05-08 16:51:27 -05:00
parent b8e1006901
commit e122de36db
6 changed files with 19 additions and 7 deletions

View File

@ -43,6 +43,7 @@ All rights reserved.
INCLUDE_DATA INCLUDE_DATA
INCLUDE_ANIMATION_DATA INCLUDE_ANIMATION_DATA
INCLUDE_MONSTER_LIST
INCLUDE_game INCLUDE_game
Bomb::Bomb(const vf2d pos,const float z,const float gravity,const float detonationTime,const float bombFadeoutTime,const float bombKnockbackFactor,const vf2d targetPos,const float radius,const int damage,const bool upperLevel,const bool friendly,const Pixel col,const vf2d scale) Bomb::Bomb(const vf2d pos,const float z,const float gravity,const float detonationTime,const float bombFadeoutTime,const float bombKnockbackFactor,const vf2d targetPos,const float radius,const int damage,const bool upperLevel,const bool friendly,const Pixel col,const vf2d scale)
@ -65,19 +66,28 @@ void Bomb::Update(float fElapsedTime){
if(fadeOutTime==0.f){ if(fadeOutTime==0.f){
z=0; //Force the bomb to be grounded. z=0; //Force the bomb to be grounded.
fadeOutTime=bombFadeoutTime; fadeOutTime=bombFadeoutTime;
game->AddEffect(std::make_unique<BombBoom>(pos,0.f,OnUpperLevel(),scale*1.5f/*Upscale 24x24 to 36x36*/,1.f,vf2d{},WHITE,0.f,0.f,true)); game->AddEffect(std::make_unique<BombBoom>(pos,0.f,OnUpperLevel(),vf2d{radius,radius}/12.f/1.5f/*Upscale 24x24 to 36x36*/,1.f,vf2d{},WHITE,0.f,0.f,true));
float distToPlayer=geom2d::line<float>(pos,game->GetPlayer()->GetPos()).length();
if(friendly){ if(friendly){
const MonsterHurtList hurtEnemies=game->HurtEnemies(pos,radius,damage,OnUpperLevel(),z); const MonsterHurtList hurtEnemies=game->HurtEnemies(pos,radius,damage,OnUpperLevel(),z);
for(auto&[monsterPtr,wasHit]:hurtEnemies){ for(auto&[monsterPtr,wasHit]:hurtEnemies){
if(wasHit)monsterPtr->ProximityKnockback(pos,bombKnockbackFactor); if(wasHit)monsterPtr->ProximityKnockback(pos,bombKnockbackFactor);
} }
if(distToPlayer<=radius){
game->GetPlayer()->ProximityKnockback(pos,bombKnockbackFactor);
}
}else{ }else{
float distToPlayer=geom2d::line<float>(pos,game->GetPlayer()->GetPos()).length();
if(distToPlayer<=radius){ if(distToPlayer<=radius){
if(game->GetPlayer()->Hurt(damage,OnUpperLevel(),z)){ if(game->GetPlayer()->Hurt(damage,OnUpperLevel(),z)){
game->GetPlayer()->ProximityKnockback(pos,bombKnockbackFactor); game->GetPlayer()->ProximityKnockback(pos,bombKnockbackFactor);
} }
} }
for(auto&monsterPtr:MONSTER_LIST){
float distToMonster=geom2d::line<float>(pos,monsterPtr->GetPos()).length();
if(distToMonster<=radius){
monsterPtr->ProximityKnockback(pos,bombKnockbackFactor);
}
}
} }
} }
} }

View File

@ -143,8 +143,8 @@ void Bullet::_Update(const float fElapsedTime){
void Bullet::Draw()const{ void Bullet::Draw()const{
if(GetZ()>0){ if(GetZ()>0){
vf2d shadowScale=vf2d{8*(radius/12.f)/3.f,1}/std::max(1.f,GetZ()/24); vf2d shadowScale=vf2d{8*scale.x/3.f,1}/std::max(1.f,GetZ()/8);
game->view.DrawDecal(pos-vf2d{3,3}*shadowScale/2+vf2d{0,6*(radius/12.f)},GFX["circle.png"].Decal(),shadowScale,BLACK); game->view.DrawDecal(pos-vf2d{3,3}*shadowScale/2+vf2d{0,12*scale.y},GFX["circle.png"].Decal(),shadowScale,BLACK);
} }
if(animated){ if(animated){

View File

@ -71,7 +71,7 @@ void Monster::STRATEGY::GOBLIN_BOMB(Monster&m,float fElapsedTime,std::string str
float distToPlayer=geom2d::line<float>(m.GetPos(),game->GetPlayer()->GetPos()).length(); float distToPlayer=geom2d::line<float>(m.GetPos(),game->GetPlayer()->GetPos()).length();
if(m.F(A::SHOOT_TIMER)>=ConfigFloat("Bomb Reload Time")&&distToPlayer<=ConfigFloat("Bomb Max Range")){ if(m.F(A::SHOOT_TIMER)>=ConfigFloat("Bomb Reload Time")&&distToPlayer<=ConfigFloat("Bomb Max Range")){
vf2d targetThrowPos=geom2d::line<float>(m.GetPos(),game->GetPlayer()->GetPos()).rpoint(distToPlayer-ConfigFloat("Bomb Distance Variation")+util::random(ConfigFloat("Bomb Distance Variation")*2.f)); vf2d targetThrowPos=geom2d::line<float>(m.GetPos(),game->GetPlayer()->GetPos()).rpoint(distToPlayer-ConfigFloat("Bomb Distance Variation")+util::random(ConfigFloat("Bomb Distance Variation")*2.f));
CreateBullet(Bomb)(m.GetPos(),ConfigFloat("Bomb Starting Z"),ConfigFloat("Bomb Gravity"),ConfigFloat("Bomb Detonation Time"),ConfigFloat("Bomb Fadeout Time"),ConfigFloat("Bomb Knockback Factor"),targetThrowPos,ConfigFloat("Bomb Radius")/100.f*24,m.GetAttack(),m.OnUpperLevel(),false,WHITE,vf2d{3,3})EndBullet; CreateBullet(Bomb)(m.GetPos(),ConfigFloat("Bomb Starting Z"),ConfigFloat("Bomb Gravity"),ConfigFloat("Bomb Detonation Time"),ConfigFloat("Bomb Fadeout Time"),ConfigFloat("Bomb Knockback Factor"),targetThrowPos,ConfigFloat("Bomb Radius")/100.f*12,m.GetAttack(),m.OnUpperLevel())EndBullet;
m.UpdateFacingDirection(game->GetPlayer()->GetPos()); m.UpdateFacingDirection(game->GetPlayer()->GetPos());
m.PerformShootAnimation(); m.PerformShootAnimation();
m.B(A::IGNORE_DEFAULT_ANIMATIONS)=true; m.B(A::IGNORE_DEFAULT_ANIMATIONS)=true;

View File

@ -18,3 +18,5 @@ Look into removing OVERRIDE from rumble settings. It looks like it was used to p
Move old maps from master branch into demo branch (has boundary changes) Move old maps from master branch into demo branch (has boundary changes)
When a monster spawns, if it spawns inside a collision tile, attempt to set it outside somewhere and make a warning popup. When a monster spawns, if it spawns inside a collision tile, attempt to set it outside somewhere and make a warning popup.
New Monster Sound Effects

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_BUILD 9230 #define VERSION_BUILD 9237
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a