Warrior sword swing now lingers for the entirety of the animation instead of only applying damage immediately on use. Release Build 8451.

This commit is contained in:
sigonasr2 2024-03-26 17:31:34 -05:00
parent 3c315da193
commit 9ca52cbead
12 changed files with 37 additions and 24 deletions

View File

@ -159,6 +159,8 @@ AiL::AiL()
_DEBUG_MAP_LOAD_INFO=bool("debug_map_load_info"_I);
MONSTER_LIST.reserve(500); //This is going to make it so the monster limit is soft-capped. We have hitlists in this game that may store pointers to monsters, this hopefully protects them from invalidated pointers. Worst-case-scenario we get double hits when there are more than 500 monsters on-screen at once which I really don't think will ever occur.
std::string CONFIG_PATH = "config_path"_S;
std::string GFX_CONFIG = CONFIG_PATH + "gfx_config"_S;
@ -758,7 +760,7 @@ void AiL::UpdateBullets(float fElapsedTime){
}
std::erase_if(BULLET_LIST,[](std::unique_ptr<Bullet>&b){return b->dead;});
}
const MonsterHurtList AiL::HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel,float z){
const MonsterHurtList AiL::HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel,float z)const{
MonsterHurtList hitList;
for(Monster&m:MONSTER_LIST){
if(geom2d::overlaps(geom2d::circle(pos,radius),geom2d::circle(m.GetPos(),12*m.GetSizeMult()))){
@ -769,6 +771,19 @@ const MonsterHurtList AiL::HurtEnemies(vf2d pos,float radius,int damage,bool upp
return hitList;
}
const MonsterHurtList AiL::HurtEnemiesNotHit(vf2d pos,float radius,int damage,HitList&hitList,bool upperLevel,float z){
MonsterHurtList affectedList;
for(Monster&m:MONSTER_LIST){
if(!hitList.count(&m)&&geom2d::overlaps(geom2d::circle(pos,radius),geom2d::circle(m.GetPos(),12*m.GetSizeMult()))){
HurtReturnValue returnVal=m.Hurt(damage,upperLevel,z);
affectedList.push_back({&m,returnVal});
hitList.insert(&m);
}
}
return affectedList;
}
void AiL::PopulateRenderLists(){
monstersBeforeLower.clear();
monstersAfterLower.clear();
@ -3827,7 +3842,9 @@ void AiL::UpdateMonsters(){
m.Update(game->GetElapsedTime());
}
for(Monster&m:game->monstersToBeSpawned){
size_t prevCapacity=MONSTER_LIST.capacity();
MONSTER_LIST.push_back(m);
if(MONSTER_LIST.capacity()>prevCapacity)LOG(std::format("WARNING! The monster list has automatically reserved more space and resized to {}! This caused one potential frame where bullet/effect hitlists that stored information on what monsters were hit to potentially be hit a second time or cause monsters that should've been hit to never be hit. Consider starting with a larger default reserved size for MONSTER_LIST if your intention was to have this many monsters!",MONSTER_LIST.capacity()));
}
game->monstersToBeSpawned.clear();
}

View File

@ -215,7 +215,9 @@ public:
void AddEffect(std::unique_ptr<Effect>foreground,std::unique_ptr<Effect>background);
//If back is true, places the effect in the background
void AddEffect(std::unique_ptr<Effect>foreground,bool back=false);
const MonsterHurtList HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel,float z);
const MonsterHurtList HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel,float z)const;
//NOTE: This function will also add any enemies that were hit into the hit list!
const MonsterHurtList HurtEnemiesNotHit(vf2d pos,float radius,int damage,HitList&hitList,bool upperLevel,float z);
vf2d GetWorldMousePos();
bool LeftHeld();
bool RightHeld();

View File

@ -37,6 +37,9 @@ All rights reserved.
#pragma endregion
#pragma once
#include "Animation.h"
#include <unordered_set>
class Monster;
using HitList=std::unordered_set<Monster*>;
struct Effect{
friend class AiL;
@ -86,4 +89,6 @@ struct PulsatingFire:Effect{
struct SwordSlash:Effect{
SwordSlash(float lifetime,std::string imgFile,vf2d size={1,1},float fadeout=0.0f,vf2d spd={},Pixel col=WHITE,float rotation=0,float rotationSpd=0,bool additiveBlending=false);
bool Update(float fElapsedTime)override;
private:
HitList hitList;
};

View File

@ -263,7 +263,7 @@ float Player::GetSizeMult(){
}
float Player::GetAttackRangeMult(){
return attack_range;
return attack_range*GetSizeMult();
}
float Player::GetSpinAngle(){

View File

@ -44,6 +44,10 @@ SwordSlash::SwordSlash(float lifetime, std::string imgFile, vf2d size, float fad
:Effect(game->GetPlayer()->GetPos(),lifetime,imgFile,game->GetPlayer()->OnUpperLevel(),size,fadeout,spd,col,rotation,rotationSpd,additiveBlending){}
bool SwordSlash::Update(float fElapsedTime){
if(lifetime>0){
game->HurtEnemiesNotHit(game->GetPlayer()->GetPos(),game->GetPlayer()->GetAttackRangeMult()*12.f,game->GetPlayer()->GetAttack(),hitList,game->GetPlayer()->OnUpperLevel(),game->GetPlayer()->GetZ());
}
pos=game->GetPlayer()->GetPos();
return Effect::Update(fElapsedTime);
}

View File

@ -1,22 +1,6 @@
February 28th -> Begin Internal Game Playtesting
March 6th -> Discord/Friend Playtesting
March 30th -> Public Demo Release
end of worldmap is visible. needs to be extended a little bit
distance on 1_1 between first and second Enemy spawn feels to empty
Materials for initial craft seems to be wrong? need to recheck
do we need a minimap? (maybe with fog of war?) Maybe polling that once testing with more people.
should gemstones dropp from boss stages aswell? (Maybe lower droprate?)
Toggle for displaying error messages
Equip Gear using Start menu tutorial
Steam Controller SDK
Steam Rich Presence
Add in vsync system option
Sword attack should linger
============================================
Make another actions config file for the main build (The app # is different)

View File

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

View File

@ -82,7 +82,6 @@ bool Warrior::AutoAttack(){
float targetDirection;
if(closest!=nullptr){
closest->Hurt(int(GetAttack()*"Warrior.Auto Attack.DamageMult"_F),OnUpperLevel(),GetZ());
float dirToEnemy=geom2d::line<float>(GetPos(),closest->GetPos()).vector().polar().y;
targetDirection=dirToEnemy;
SetAnimationBasedOnTargetingDirection(dirToEnemy);
@ -93,9 +92,9 @@ bool Warrior::AutoAttack(){
}
attack_cooldown_timer=ATTACK_COOLDOWN-GetAttackRecoveryRateReduction();
swordSwingTimer="Warrior.Auto Attack.SwordSwingTime"_F;
swordSwingTimer="Warrior.Auto Attack.SwordAnimationSwingTime"_F;
game->AddEffect(std::make_unique<SwordSlash>(0.15f,"swordslash.png"s,vf2d{1.f,1.f}*"Warrior.Auto Attack.Range"_F/100.f,0.1f,vf2d{0.f,0.f},WHITE,targetDirection));
game->AddEffect(std::make_unique<SwordSlash>(0.125f,"swordslash.png"s,vf2d{0.9f,0.9f}*"Warrior.Auto Attack.Range"_F/100.f,0.1f,vf2d{0.f,0.f},WHITE,targetDirection));
SetState(State::SWING_SWORD);
SoundEffect::PlaySFX("Warrior Auto Attack",SoundEffect::CENTERED);

View File

@ -20,7 +20,8 @@ Warrior
# Whether or not this ability cancels casts.
CancelCast = 1
SwordSwingTime = 0.2
SwordAnimationSwingTime = 0.2s
SwordSlashLingerTime = 0.125s
}
Right Click Ability
{

View File

@ -7,6 +7,7 @@
#ifndef MATCHMAKINGTYPES_H
#define MATCHMAKINGTYPES_H
#include "olcPixelGameEngine.h"
#include <stdio.h>
#include <string.h>