Triple Toss enchant implemented. Fix obscure edge-case bug where the camera position, mouse position, and player positions are all equal causing a mouse aiming location length of (0,0) resulting in infinity size velocities. Release Build 10952.

mac-build
sigonasr2 6 months ago
parent 2d3dbfac3c
commit ab98adf094
  1. 18
      Adventures in Lestoria Tests/EnchantTests.cpp
  2. 9
      Adventures in Lestoria/Player.cpp
  3. 2
      Adventures in Lestoria/Player.h
  4. 4
      Adventures in Lestoria/TMXParser.h
  5. 2
      Adventures in Lestoria/Version.h
  6. 1
      Adventures in Lestoria/assets/config/items/ItemEnchants.txt
  7. BIN
      x64/Release/Adventures in Lestoria.exe

@ -92,6 +92,7 @@ namespace EnchantTests
#pragma region Setup a fake test map and test monster
game->MAP_DATA["CAMPAIGN_1_1"];
game->MAP_DATA["CAMPAIGN_1_1"]._SetMapData(MapTag{50,50,24,24});
ItemDrop::ClearDrops();
MonsterData testMonsterData{"TestName","Test Monster",1000,10,5,{MonsterDropData{"Health Potion",100.f,1,1}},200.f};
MONSTER_DATA["TestName"]=testMonsterData;
@ -646,5 +647,22 @@ namespace EnchantTests
Assert::AreEqual(originalIframeTime+"Thief.Right Click Ability.Iframe Time"_F*"Tumble"_ENC["BOOST PERCENTAGE"]/100.f,player->GetIframeTime(),L"Iframe time should be longer.");
Assert::AreEqual(originalMovespdIntensity+originalMovespdIntensity*"Tumble"_ENC["BOOST PERCENTAGE"]/100.f,player->GetBuffs(BuffType::SPEEDBOOST)[0].intensity,L"Player should have a movespeed buff with greater intensity.");
}
TEST_METHOD(TripleTossCheck){
testKey->bHeld=true; //Force the key to be held down for testing purposes.
game->ChangePlayerClass(THIEF);
player=game->GetPlayer();
player->CheckAndPerformAbility(player->GetAbility1(),testKeyboardInput);
game->SetElapsedTime(0.5f);
game->OnUserUpdate(0.5f);
Assert::AreEqual(size_t(1),BULLET_LIST.size(),L"Only 1 dagger has spawned without the Triple Toss enchant.");
std::weak_ptr<Item>nullRing{Inventory::AddItem("Null Ring"s)};
Inventory::EquipItem(nullRing,EquipSlot::RING1);
nullRing.lock()->EnchantItem("Triple Toss");
player->GetAbility1().charges++;
player->CheckAndPerformAbility(player->GetAbility1(),testKeyboardInput);
game->SetElapsedTime(0.5f);
game->OnUserUpdate(0.5f);
Assert::AreEqual(size_t(4),BULLET_LIST.size(),L"The Triple Toss enchant should add 3 more daggers to the list.");
}
};
}

@ -759,6 +759,10 @@ void Player::Update(float fElapsedTime){
const float daggerLifetime{"Thief.Ability 1.Dagger Range"_F/"Thief.Ability 1.Dagger Speed"_F};
if(HasEnchant("Triple Toss")){
CreateBullet(Bullet)(GetPos(),vf2d{"Thief.Ability 1.Dagger Speed"_F,angleToCursor+util::degToRad("Triple Toss"_ENC["SPREAD ANGLE"])}.cart(),"Thief.Ability 1.Dagger Radius"_F,GetAttack()*"Thief.Ability 1.Damage"_I,"dagger.png",OnUpperLevel(),false,daggerLifetime,true,true,WHITE,{1.f,1.f},0.f,"Dagger Hit")EndBullet;
CreateBullet(Bullet)(GetPos(),vf2d{"Thief.Ability 1.Dagger Speed"_F,angleToCursor-util::degToRad("Triple Toss"_ENC["SPREAD ANGLE"])}.cart(),"Thief.Ability 1.Dagger Radius"_F,GetAttack()*"Thief.Ability 1.Damage"_I,"dagger.png",OnUpperLevel(),false,daggerLifetime,true,true,WHITE,{1.f,1.f},0.f,"Dagger Hit")EndBullet;
}
CreateBullet(Bullet)(GetPos(),vf2d{"Thief.Ability 1.Dagger Speed"_F,angleToCursor}.cart(),"Thief.Ability 1.Dagger Radius"_F,GetAttack()*"Thief.Ability 1.Damage"_I,"dagger.png",OnUpperLevel(),false,daggerLifetime,true,true,WHITE,{1.f,1.f},0.f,"Dagger Hit")EndBullet;
}
daggerThrowWaitTimer-=fElapsedTime;
@ -1672,7 +1676,10 @@ void Player::Knockup(float duration){
}
const vf2d Player::GetWorldAimingLocation(bool useWalkDir,bool invert){
return game->view.ScreenToWorld(GetAimingLocation(useWalkDir,invert));
const vf2d screenAimingLoc{game->view.ScreenToWorld(GetAimingLocation(useWalkDir,invert))};
if(screenAimingLoc==GetPos())return GetPos()+vf2d{0,-1.f};
else return screenAimingLoc;
}
const vf2d Player::GetAimingLocation(bool useWalkDir,bool invert){

@ -275,7 +275,6 @@ public:
//Knockup the player for duration amount of seconds, and Zamt pixels.
void Knockup(float duration);
static const bool INVERTED,USE_WALK_DIR;
const vf2d GetAimingLocation(bool useWalkDir=false,bool invert=false);
const vf2d GetWorldAimingLocation(bool useWalkDir=false,bool invert=false);
void SetXP(const uint64_t xp);
void SetTotalXPEarned(const uint64_t totalXP);
@ -391,6 +390,7 @@ private:
void OnAbilityUse(const Ability&ability); //Callback when an ability successfully is used and has gone on cooldown.
const bool LastReserveEnchantConditionsMet()const;
float poisonArrowLastParticleTimer{};
const vf2d GetAimingLocation(bool useWalkDir=false,bool invert=false);
protected:
const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F;
const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F;

@ -144,6 +144,7 @@ private:
std::map<std::string,std::vector<::ZoneData>>ZoneData;
public:
Map();
void _SetMapData(MapTag data);
bool skipLoadoutScreen=false;
const MapTag&GetMapData()const;
const std::string_view GetMapType()const;
@ -310,6 +311,9 @@ class TMXParser{
const MapName&Map::GetMapName()const{
return name;
}
void Map::_SetMapData(MapTag data){
MapData=data;
}
const MapTag&Map::GetMapData()const{
return MapData;
}

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 2
#define VERSION_PATCH 3
#define VERSION_BUILD 10947
#define VERSION_BUILD 10952
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -177,6 +177,7 @@ Item Enchants
Affects = Ability 1
NEW DAGGER COUNT = 3
SPREAD ANGLE = 35deg
# Stat, Lowest, Highest Value
# Stat Modifier[0] = ..., 0, 0

Loading…
Cancel
Save