diff --git a/Adventures in Lestoria/BulletTypes.h b/Adventures in Lestoria/BulletTypes.h index a3f51531..6c7c4e36 100644 --- a/Adventures in Lestoria/BulletTypes.h +++ b/Adventures in Lestoria/BulletTypes.h @@ -98,10 +98,13 @@ struct Arrow:public Bullet{ struct ChargedArrow:public Bullet{ vf2d lastLaserPos; ChargedArrow(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly=false,Pixel col=WHITE); + ChargedArrow(const std::string&shotArrowGraphic,const std::string&laserGraphic,vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly=false,Pixel col=WHITE); void Update(float fElapsedTime)override; BulletDestroyState PlayerHit(Player*player)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _PlayerHit()!! BulletDestroyState MonsterHit(Monster&monster,const uint8_t markStacksBeforeHit)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _MonsterHit()!! void ModifyOutgoingDamageData(HurtDamageInfo&data); +private: + std::string laserGraphic; }; struct FrogTongue:public Bullet{ diff --git a/Adventures in Lestoria/ChargedArrow.cpp b/Adventures in Lestoria/ChargedArrow.cpp index d80580e9..d56904e2 100644 --- a/Adventures in Lestoria/ChargedArrow.cpp +++ b/Adventures in Lestoria/ChargedArrow.cpp @@ -45,9 +45,12 @@ All rights reserved. INCLUDE_game ChargedArrow::ChargedArrow(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly,Pixel col) - :lastLaserPos(pos), - Bullet(pos,vel,radius,damage, - "charged_shot_arrow.png",upperLevel,true,INFINITE,true,friendly,col){} + :lastLaserPos(pos),laserGraphic("laser.png"), + Bullet(pos,vel,radius,damage,"charged_shot_arrow.png",upperLevel,true,INFINITE,true,friendly,col){} + +ChargedArrow::ChargedArrow(const std::string&shotArrowGraphic,const std::string&laserGraphic,vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly,Pixel col) + :lastLaserPos(pos),laserGraphic(laserGraphic), + Bullet(pos,vel,radius,damage,shotArrowGraphic,upperLevel,true,INFINITE,true,friendly,col){} void ChargedArrow::Update(float fElapsedTime){ geom2d::line lineToCurrentPos(geom2d::line(lastLaserPos,pos)); @@ -58,7 +61,7 @@ void ChargedArrow::Update(float fElapsedTime){ const float normalBeamRadius{12*"Ranger.Ability 2.Radius"_F/100/5}; float laserWidth{radius/normalBeamRadius}; - game->AddEffect(std::make_unique(midpoint,0.1f,"laser.png",upperLevel,vf2d{laserWidth,dist*2},0.3f,vf2d{},Pixel{192,128,238},atan2(pos.y-lastLaserPos.y,pos.x-lastLaserPos.x)+PI/2,0,true)); + game->AddEffect(std::make_unique(midpoint,0.1f,laserGraphic,upperLevel,vf2d{laserWidth,dist*2},0.3f,vf2d{},Pixel{192,128,238},atan2(pos.y-lastLaserPos.y,pos.x-lastLaserPos.x)+PI/2,0,true)); lastLaserPos=pos; } } diff --git a/Adventures in Lestoria/Pirate_Buccaneer.cpp b/Adventures in Lestoria/Pirate_Buccaneer.cpp index 2eae8470..99e3fecb 100644 --- a/Adventures in Lestoria/Pirate_Buccaneer.cpp +++ b/Adventures in Lestoria/Pirate_Buccaneer.cpp @@ -47,5 +47,76 @@ using A=Attribute; INCLUDE_game void Monster::STRATEGY::PIRATE_BUCCANEER(Monster&m,float fElapsedTime,std::string strategy){ + #pragma region Phase, Animation, and Helper function setup + enum PhaseName{ + INIT, + MOVE, + LOCKON, + WINDUP, + FIRE_ANIMATION, + }; + #pragma endregion + switch(m.phase){ + case INIT:{ + m.phase=MOVE; + }break; + case MOVE:{ + m.F(A::ATTACK_COOLDOWN)+=fElapsedTime; + + float distToPlayer=m.GetDistanceFrom(game->GetPlayer()->GetPos()); + + const bool outsideMaxShootingRange=distToPlayer>=ConfigPixelsArr("Stand Still and Shoot Range",1); + + auto PrepareToShoot=[&](){ + m.phase=WINDUP; + m.F(A::SHOOT_TIMER)=ConfigFloat("Attack Windup Time"); + m.PerformAnimation("SHOOT",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos())); + }; + + if(outsideMaxShootingRange){ + m.target=game->GetPlayer()->GetPos(); + RUN_TOWARDS(m,fElapsedTime,"Run Towards"); + }else + if(m.F(A::ATTACK_COOLDOWN)>=ConfigFloat("Attack Reload Time")){ + PrepareToShoot(); + }else + if(distToPlayer(m.GetPos(),game->GetPlayer()->GetPos()).upoint(-1); + RUN_TOWARDS(m,fElapsedTime,"Run Towards"); + }else + if(m.F(A::ATTACK_COOLDOWN)>=ConfigFloat("Attack Reload Time")/2.f){ //Only the stand still and shoot range remains, which is twice as fast... + PrepareToShoot(); + } + }break; + case WINDUP:{ + m.F(A::SHOOT_TIMER)-=fElapsedTime; + if(m.F(A::SHOOT_TIMER)<=0){ + m.F(A::ATTACK_COOLDOWN)=0.f; + CreateBullet(ChargedArrow)("musket_bullet.png","musket_trail.png",m.GetPos(),util::pointTo(m.GetPos(),m.V(A::LOCKON_POS))*ConfigFloat("Arrow Spd"),ConfigFloat("Arrow Hitbox Radius"),m.GetAttack(),m.OnUpperLevel())EndBullet; + m.PerformAnimation("SHOOTING",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos())); + m.SetStrategyDrawFunction([](AiL*game,Monster&monster,const std::string&strategy){}); + m.phase=FIRE_ANIMATION; + m.F(A::SHOOT_TIMER)=m.GetCurrentAnimation().GetTotalAnimationDuration(); + }else + if(m.F(A::SHOOT_TIMER)>=ConfigFloat("Attack Lockon Time")){ + m.V(A::LOCKON_POS)=game->GetPlayer()->GetPos(); + m.PerformAnimation("SHOOT",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos())); + const float arrowHitboxRadius{ConfigFloat("Arrow Hitbox Radius")}; + m.SetStrategyDrawFunction([arrowHitboxRadius](AiL*game,Monster&monster,const std::string&strategy){ + vf2d midpoint{geom2d::line(monster.GetPos(),monster.V(A::LOCKON_POS)).rpoint(800.f)}; + float shootingAngle{util::angleTo(monster.GetPos(),monster.V(A::LOCKON_POS))+PI/2}; + vf2d imgSize{arrowHitboxRadius*2.f,800.f}; + game->view.DrawPartialRotatedDecal(midpoint,GFX["line_indicator.png"].Decal(),shootingAngle,GFX["line_indicator.png"].Sprite()->Size()/2,{},GFX["line_indicator.png"].Sprite()->Size(),imgSize/GFX["line_indicator.png"].Sprite()->Size()); + }); + } + }break; + case FIRE_ANIMATION:{ + m.F(A::SHOOT_TIMER)-=fElapsedTime; + if(m.F(A::SHOOT_TIMER)<=0.f){ + m.PerformAnimation("IDLE",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos())); + m.phase=MOVE; + } + }break; + } } \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 9613e9db..43d1194c 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_PATCH 0 -#define VERSION_BUILD 11609 +#define VERSION_BUILD 11621 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/Campaigns/3_1.tmx b/Adventures in Lestoria/assets/Campaigns/3_1.tmx index 2e7a9c72..8a47ca7c 100644 --- a/Adventures in Lestoria/assets/Campaigns/3_1.tmx +++ b/Adventures in Lestoria/assets/Campaigns/3_1.tmx @@ -1,5 +1,5 @@ - + @@ -865,22 +865,12 @@ - + - - - - - - - - - - - + diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index d2de81b3..ac92a84e 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -1103,7 +1103,26 @@ MonsterStrategy } Pirate Buccaneer { + Attack Reload Time = 2.0s + + # How long it takes to prepare the attack once an attack is queued. + Attack Windup Time = 1.0s + + # How much of the windup time is spent without the aiming direction changing. + Attack Lockon Time = 0.3s + + Arrow Spd = 800 + + Arrow Hitbox Radius = 6 + # How long the monster must stop turning their aim and lock in the target. The longer, the easier it is to dodge. + Bow Steadying Time = 0.33s + + # When the monster will attempt to run away from target. + Run Away Range = 1000 + # Does not move and shoots from anywhere in these ranges. + Stand Still and Shoot Range = 800,1200 + # Anything outside the max "Stand Still and Shoot Range" will cause the monster to move towards the target instead. } Parrot { diff --git a/Adventures in Lestoria/assets/config/Monsters.txt b/Adventures in Lestoria/assets/config/Monsters.txt index 0d786b29..65fae874 100644 --- a/Adventures in Lestoria/assets/config/Monsters.txt +++ b/Adventures in Lestoria/assets/config/Monsters.txt @@ -1391,9 +1391,6 @@ Monsters Strategy = Pirate Captain - # Wait time override for Run Towards strategy. - WaitTime = 0 - #Size of each animation frame SheetFrameSize = 36,36 @@ -1440,9 +1437,6 @@ Monsters Strategy = Pirate Buccaneer - # Wait time override for Run Towards strategy. - WaitTime = 0 - #Size of each animation frame SheetFrameSize = 48,48 @@ -1484,9 +1478,6 @@ Monsters Strategy = Crab - # Wait time override for Run Towards strategy. - WaitTime = 0 - #Size of each animation frame SheetFrameSize = 48,48 @@ -1527,9 +1518,6 @@ Monsters Strategy = Crab - # Wait time override for Run Towards strategy. - WaitTime = 0 - #Size of each animation frame SheetFrameSize = 48,48 @@ -1570,9 +1558,6 @@ Monsters Strategy = Seagull - # Wait time override for Run Towards strategy. - WaitTime = 0 - #Size of each animation frame SheetFrameSize = 48,48 @@ -1613,9 +1598,6 @@ Monsters Strategy = Sandworm - # Wait time override for Run Towards strategy. - WaitTime = 0 - #Size of each animation frame SheetFrameSize = 96,96 diff --git a/Adventures in Lestoria/assets/config/gfx/gfx.txt b/Adventures in Lestoria/assets/config/gfx/gfx.txt index a6581f65..1673d2c3 100644 --- a/Adventures in Lestoria/assets/config/gfx/gfx.txt +++ b/Adventures in Lestoria/assets/config/gfx/gfx.txt @@ -133,6 +133,9 @@ Images GFX_Comet = comet.png GFX_CometFlare = comet_flare.png GFX_DownArrow = downarrow.png + GFX_MusketTrail = musket_trail.png + GFX_LineIndicator = line_indicator.png + GFX_MusketBullet = musket_bullet.png GFX_Thief_Sheet = nico-thief.png GFX_Trapper_Sheet = nico-trapper.png diff --git a/Adventures in Lestoria/assets/gamepack.pak b/Adventures in Lestoria/assets/gamepack.pak index 51e7a614..6fcc93ab 100644 Binary files a/Adventures in Lestoria/assets/gamepack.pak and b/Adventures in Lestoria/assets/gamepack.pak differ diff --git a/Adventures in Lestoria/assets/line_indicator.png b/Adventures in Lestoria/assets/line_indicator.png new file mode 100644 index 00000000..963c437c Binary files /dev/null and b/Adventures in Lestoria/assets/line_indicator.png differ diff --git a/Adventures in Lestoria/assets/musket_bullet.png b/Adventures in Lestoria/assets/musket_bullet.png new file mode 100644 index 00000000..7dfeb5d9 Binary files /dev/null and b/Adventures in Lestoria/assets/musket_bullet.png differ diff --git a/Adventures in Lestoria/assets/musket_trail.png b/Adventures in Lestoria/assets/musket_trail.png new file mode 100644 index 00000000..e3b2cbe3 Binary files /dev/null and b/Adventures in Lestoria/assets/musket_trail.png differ diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 18672ece..97bb1a6f 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ