Compare commits

...

3 Commits

5 changed files with 20 additions and 9 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,8 +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;
for(int i=0;i<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/"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<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;
@ -160,8 +168,12 @@ void Ranger::InitializeClassAbilities(){
const float newAngle=shootingAngle+leftAngle/2+i*increment;
geom2d::line pointTowardsCursor=geom2d::line(p->GetPos(),p->GetPos()+vf2d{cos(newAngle),sin(newAngle)}*shootingDist);
vf2d extendedLine=pointTowardsCursor.upoint(1.1f);
BULLET_LIST.push_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,int(p->GetAttack()*"Ranger.Ability 3.DamageMult"_F),p->OnUpperLevel(),true)));
int finalArrowDamage{perArrowDamage};
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;
}
if(totalDamageCalculated!=intendedTotalDamage)ERR(std::format("WARNING! Multi-shot expected a total damage calculation of {} but added up to {} instead!",intendedTotalDamage,totalDamageCalculated));
p->rangerShootAnimationTimer=0.3f;
p->SetState(State::SHOOT_ARROW);
p->SetAnimationBasedOnTargetingDirection("SHOOT",shootingAngle);

View File

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

View File

@ -138,7 +138,7 @@ Ranger
# Whether or not this ability cancels casts.
CancelCast = 0
Description = Prepares and fires a fan of {ArrowCount} packed arrows. Total Damage: {DamageMult:TotalDamageMult}.
Description = Prepares and fires a fan of {ArrowCount} packed arrows. Total Damage: {DamageMult:DamageMult}.
#RGB Values. Color 1 is the circle at full cooldown, Color 2 is the color at empty cooldown.
Cooldown Bar Color 1 = 64, 0, 0, 192
@ -148,11 +148,10 @@ Ranger
Casting Range = 0
Casting Size = 0
# Damage multiplier per shot
DamageMult = 1.0
# Total Damage multiplier of all shots combined.
DamageMult = 6.0
# Number of arrows in the shot spread.
ArrowCount = 6
TotalDamageMult = 6.0
# How far the shot spread in one angle is. For example, if the value here is set to 18.375, then Multishot divides the arrows evenly from a span of -18.375 degrees to the left to 18.375 degrees to the right of the player.
MultiShotSpread = 18.375
# Speed of arrows that Rapid Fire shoots out.