Fix issues with new Multishot damage calculations (error checking was occurring). Release Build 12215.

This commit is contained in:
sigonasr2 2025-06-03 12:43:40 -05:00
parent ac2bec9650
commit ff47e0819b
3 changed files with 10 additions and 7 deletions

View File

@ -70,7 +70,7 @@ struct Ability{
PrecastData precastInfo;
bool canCancelCast=false;
InputGroup*input;
std::string icon;
std::string icon{"pixel.png"};
//If set to true, this ability is tied to using an item.
bool itemAbility=false;
//If set to true, this ability instead activates immediately when a cast occurs. When the cast finishes, nothing happens instead.

View File

@ -151,13 +151,16 @@ void Ranger::InitializeClassAbilities(){
float shootingDist=pointTowardsCursor.length();
vf2d shootingDirMiddle=pointTowardsCursor.vector();
float shootingAngle=atan2(shootingDirMiddle.y,shootingDirMiddle.x);
int arrowCount="Ranger.Ability 3.ArrowCount"_I%2==0?"Ranger.Ability 3.ArrowCount"_I+1:"Ranger.Ability 3.ArrowCount"_I;
// WARNING! This variable is NOT the actual arrow count shot out. If there is an even number, to make the algorithm shoot out a spray of arrows on both sides,
// it is programmed to add an arrow in the middle and SKIP it. Therefore DO NOT use this value as the actual arrow count.
// Use config value Ranger.Ability 3.ArrowCount Instead!!!
int algorithmArrowCount="Ranger.Ability 3.ArrowCount"_I%2==0?"Ranger.Ability 3.ArrowCount"_I+1:"Ranger.Ability 3.ArrowCount"_I;
const int intendedTotalDamage{int("Ranger.Ability 3.DamageMult"_F*p->GetAttack())};
const int perArrowDamage{std::max(1,int(p->GetAttack()*("Ranger.Ability 3.DamageMult"_F/arrowCount)))};
const int totalArrowDamage{perArrowDamage*arrowCount};
const int perArrowDamage{std::max(1,int(p->GetAttack()*("Ranger.Ability 3.DamageMult"_F/"Ranger.Ability 3.ArrowCount"_I)))};
const int totalArrowDamage{perArrowDamage*"Ranger.Ability 3.ArrowCount"_I};
const int leftoverArrowDamage{intendedTotalDamage-totalArrowDamage}; //Compared to intended damage, the amount dealt may not be completely evenly divisible. Account for the remainder here to pour into the last arrow.
int totalDamageCalculated{0};
for(int i=0;i<arrowCount;i++){
for(int i=0;i<algorithmArrowCount;i++){
if("Ranger.Ability 3.ArrowCount"_I%2==0&&i=="Ranger.Ability 3.ArrowCount"_I/2)continue;
const float halfAngle="Ranger.Ability 3.MultiShotSpread"_F*PI/180;
const float leftAngle=-halfAngle;
@ -166,7 +169,7 @@ void Ranger::InitializeClassAbilities(){
geom2d::line pointTowardsCursor=geom2d::line(p->GetPos(),p->GetPos()+vf2d{cos(newAngle),sin(newAngle)}*shootingDist);
vf2d extendedLine=pointTowardsCursor.upoint(1.1f);
int finalArrowDamage{perArrowDamage};
if(i==arrowCount-1)finalArrowDamage+=leftoverArrowDamage;
if(i==algorithmArrowCount-1)finalArrowDamage+=leftoverArrowDamage;
BULLET_LIST.emplace_back(std::make_unique<Arrow>(Arrow(p->GetPos(),extendedLine,vf2d{cos(newAngle)*"Ranger.Ability 3.ArrowSpd"_F,float(sin(newAngle)*"Ranger.Ability 3.ArrowSpd"_F-PI/8*"Ranger.Ability 3.ArrowSpd"_F)}+p->movementVelocity,12*"Ranger.Ability 3.ArrowRadius"_F/100,finalArrowDamage,p->OnUpperLevel(),true)));
totalDamageCalculated+=finalArrowDamage;
}

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 3
#define VERSION_PATCH 0
#define VERSION_BUILD 12212
#define VERSION_BUILD 12215
#define stringify(a) stringify_(a)
#define stringify_(a) #a