Merge into master
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Has been cancelled
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Has been cancelled
This commit is contained in:
commit
83317bacb6
@ -78,7 +78,7 @@ struct Ability{
|
|||||||
PrecastData precastInfo;
|
PrecastData precastInfo;
|
||||||
bool canCancelCast=false;
|
bool canCancelCast=false;
|
||||||
InputGroup*input;
|
InputGroup*input;
|
||||||
std::string icon;
|
std::string icon{"pixel.png"};
|
||||||
//If set to true, this ability is tied to using an item.
|
//If set to true, this ability is tied to using an item.
|
||||||
bool itemAbility=false;
|
bool itemAbility=false;
|
||||||
//If set to true, this ability instead activates immediately when a cast occurs. When the cast finishes, nothing happens instead.
|
//If set to true, this ability instead activates immediately when a cast occurs. When the cast finishes, nothing happens instead.
|
||||||
|
@ -37,7 +37,7 @@ All rights reserved.
|
|||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
#include "GameEvent.h"
|
#include "GameEvent.h"
|
||||||
#include <map>
|
#include <vector>
|
||||||
|
|
||||||
std::vector<std::unique_ptr<GameEvent>>GameEvent::events;
|
std::vector<std::unique_ptr<GameEvent>>GameEvent::events;
|
||||||
|
|
||||||
|
@ -151,8 +151,16 @@ void Ranger::InitializeClassAbilities(){
|
|||||||
float shootingDist=pointTowardsCursor.length();
|
float shootingDist=pointTowardsCursor.length();
|
||||||
vf2d shootingDirMiddle=pointTowardsCursor.vector();
|
vf2d shootingDirMiddle=pointTowardsCursor.vector();
|
||||||
float shootingAngle=atan2(shootingDirMiddle.y,shootingDirMiddle.x);
|
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,
|
||||||
for(int i=0;i<arrowCount;i++){
|
// 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;
|
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 halfAngle="Ranger.Ability 3.MultiShotSpread"_F*PI/180;
|
||||||
const float leftAngle=-halfAngle;
|
const float leftAngle=-halfAngle;
|
||||||
@ -160,8 +168,12 @@ void Ranger::InitializeClassAbilities(){
|
|||||||
const float newAngle=shootingAngle+leftAngle/2+i*increment;
|
const float newAngle=shootingAngle+leftAngle/2+i*increment;
|
||||||
geom2d::line pointTowardsCursor=geom2d::line(p->GetPos(),p->GetPos()+vf2d{cos(newAngle),sin(newAngle)}*shootingDist);
|
geom2d::line pointTowardsCursor=geom2d::line(p->GetPos(),p->GetPos()+vf2d{cos(newAngle),sin(newAngle)}*shootingDist);
|
||||||
vf2d extendedLine=pointTowardsCursor.upoint(1.1f);
|
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->rangerShootAnimationTimer=0.3f;
|
||||||
p->SetState(State::SHOOT_ARROW);
|
p->SetState(State::SHOOT_ARROW);
|
||||||
p->SetAnimationBasedOnTargetingDirection("SHOOT",shootingAngle);
|
p->SetAnimationBasedOnTargetingDirection("SHOOT",shootingAngle);
|
||||||
|
@ -138,7 +138,7 @@ Ranger
|
|||||||
# Whether or not this ability cancels casts.
|
# Whether or not this ability cancels casts.
|
||||||
CancelCast = 0
|
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.
|
#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
|
Cooldown Bar Color 1 = 64, 0, 0, 192
|
||||||
@ -148,11 +148,10 @@ Ranger
|
|||||||
Casting Range = 0
|
Casting Range = 0
|
||||||
Casting Size = 0
|
Casting Size = 0
|
||||||
|
|
||||||
# Damage multiplier per shot
|
# Total Damage multiplier of all shots combined.
|
||||||
DamageMult = 1.0
|
DamageMult = 6.0
|
||||||
# Number of arrows in the shot spread.
|
# Number of arrows in the shot spread.
|
||||||
ArrowCount = 6
|
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.
|
# 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
|
MultiShotSpread = 18.375
|
||||||
# Speed of arrows that Rapid Fire shoots out.
|
# Speed of arrows that Rapid Fire shoots out.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user