Player no longer bounces off of NPCs. Bonus boss no longer continues charging if it makes contact with the player. Fix undefined pointer in TMXParser.
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
99674ce6e1
commit
973813f0b5
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -91,7 +91,8 @@
|
||||
"*.inc": "cpp",
|
||||
"future": "cpp",
|
||||
"any": "cpp",
|
||||
"source_location": "cpp"
|
||||
"source_location": "cpp",
|
||||
"forward_list": "cpp"
|
||||
},
|
||||
"editor.suggest.insertMode": "replace"
|
||||
}
|
@ -54,7 +54,7 @@ DamageNumber::DamageNumber(vf2d pos,int damage,bool friendly,DamageNumberType ty
|
||||
}
|
||||
|
||||
void DamageNumber::RecalculateSize(){
|
||||
float damageMultRatio=damage/game->GetPlayer()->GetBaseStat("Attack")/2.f;
|
||||
float damageMultRatio=damage/game->GetPlayer()->GetStat("Attack")/2.f;
|
||||
riseSpd=originalRiseSpd;
|
||||
if(!friendly){
|
||||
float newSize=std::clamp(roundf(damageMultRatio),1.0f,4.0f);
|
||||
|
@ -400,6 +400,9 @@ void Monster::Collision(Player*p){
|
||||
p->Knockback(knockbackVecNorm*knockbackStrength);
|
||||
#pragma endregion
|
||||
|
||||
|
||||
B(Attribute::COLLIDED_WITH_PLAYER)=true;
|
||||
|
||||
Collision();
|
||||
}
|
||||
void Monster::Collision(Monster&m){
|
||||
@ -784,3 +787,11 @@ void Monster::SetStrategyDeathFunction(std::function<bool(GameEvent&,Monster&,co
|
||||
hasStrategyDeathFunction=true;
|
||||
strategyDeathFunc=func;
|
||||
}
|
||||
|
||||
const bool Monster::IsNPC()const{
|
||||
return MONSTER_DATA[name].IsNPC();
|
||||
}
|
||||
|
||||
const bool MonsterData::IsNPC()const{
|
||||
return isNPC;
|
||||
}
|
@ -71,7 +71,7 @@ struct MonsterDropData{
|
||||
};
|
||||
|
||||
struct MonsterData{
|
||||
private:
|
||||
private:
|
||||
std::string name;
|
||||
int hp;
|
||||
int atk;
|
||||
@ -88,7 +88,8 @@ struct MonsterData{
|
||||
EventName deathSound="";
|
||||
EventName walkSound="";
|
||||
std::vector<MonsterDropData> dropData;
|
||||
public:
|
||||
bool isNPC=false;
|
||||
public:
|
||||
MonsterData();
|
||||
MonsterData(std::string name,int hp,int atk,const uint32_t xp,std::vector<std::string>animations,std::vector<MonsterDropData>drops,float moveSpd=1.0f,float size=1.0f,std::string strategy="Run Towards",int collisionDmg=0);
|
||||
int GetHealth();
|
||||
@ -105,6 +106,7 @@ struct MonsterData{
|
||||
const EventName&GetHurtSound();
|
||||
const EventName&GetDeathSound();
|
||||
const EventName&GetWalkSound();
|
||||
const bool IsNPC()const;
|
||||
std::vector<std::string>GetAnimations(){
|
||||
return animations;
|
||||
}
|
||||
@ -193,6 +195,7 @@ public:
|
||||
void RotateTowardsPos(const vf2d&targetPos);
|
||||
const float GetDamageReductionFromBuffs()const;
|
||||
const float GetCollisionDamage()const;
|
||||
const bool IsNPC()const;
|
||||
private:
|
||||
std::string name;
|
||||
vf2d pos;
|
||||
|
@ -92,4 +92,5 @@ enum class Attribute{
|
||||
BULLETS_REMOVED,
|
||||
BEAR_STOMP_COUNT,
|
||||
PREVIOUS_PHASE,
|
||||
COLLIDED_WITH_PLAYER, //A boolean flag that is set to true when an enemy makes contact with the player.
|
||||
};
|
@ -207,7 +207,7 @@ void MonsterData::InitializeMonsterData(){
|
||||
}
|
||||
}
|
||||
void MonsterData::InitializeNPCData(){
|
||||
for(auto&[key,size]:DATA["NPCs"].GetKeys()){
|
||||
for(auto&[key,dataSize]:DATA["NPCs"].GetKeys()){
|
||||
std::string NPCName=key;
|
||||
if(MONSTER_DATA.count(key)){
|
||||
ERR("WARNING! A monster with the name "<<key<<" already exists in the database! Duplicates are not allowed.")
|
||||
@ -357,6 +357,7 @@ void MonsterData::InitializeNPCData(){
|
||||
monster.hurtSound=hurtSound;
|
||||
monster.deathSound=deathSound;
|
||||
monster.walkSound=walkSound;
|
||||
monster.isNPC=true; //If we read any data from this config file, it's definitely considered an NPC.
|
||||
|
||||
MONSTER_DATA[NPCName]=monster;
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ void Player::Update(float fElapsedTime){
|
||||
}else{
|
||||
m.SetPos(line.rpoint(dist*1.1f));
|
||||
}
|
||||
if(m.IsAlive()){
|
||||
if(m.IsAlive()&&!m.IsNPC()){ //Don't set the knockback if this monster is actually an NPC. Let's just push them around.
|
||||
vel=line.vector().norm()*-128;
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ class TMXParser{
|
||||
XMLTag monsterTag;
|
||||
XMLTag npcTag;
|
||||
XMLTag spawnerLinkTag;
|
||||
StagePlate*currentStagePlate;
|
||||
StagePlate*currentStagePlate=nullptr;
|
||||
std::vector<XMLTag>accumulatedMonsterTags;
|
||||
std::map<int,StagePlate>stagePlates;
|
||||
bool infiniteMap=false;
|
||||
@ -514,11 +514,11 @@ class TMXParser{
|
||||
}
|
||||
}
|
||||
}else{
|
||||
#if _DEBUG
|
||||
#ifdef _DEBUG
|
||||
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Unsupported tag format! Ignoring."<<"\n";
|
||||
#endif
|
||||
}
|
||||
#if _DEBUG
|
||||
#ifdef _DEBUG
|
||||
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"\n"<<"=============\n";
|
||||
#endif
|
||||
}
|
||||
|
@ -306,6 +306,7 @@ void Monster::STRATEGY::URSULE(Monster&m,float fElapsedTime,std::string strategy
|
||||
m.F(A::CASTING_TIMER)=ConfigFloat("Phase 3.Charge Cast Time");
|
||||
m.UpdateFacingDirection(geom2d::line<float>(m.GetPos(),game->GetPlayer()->GetPos()).vector());
|
||||
m.PerformOtherAnimation(4);
|
||||
m.B(A::COLLIDED_WITH_PLAYER)=false;
|
||||
}
|
||||
}
|
||||
if(m.F(A::CASTING_TIMER)>0.f){
|
||||
@ -350,7 +351,7 @@ void Monster::STRATEGY::URSULE(Monster&m,float fElapsedTime,std::string strategy
|
||||
|
||||
float distToTarget=geom2d::line<float>(m.target,m.GetPos()).length();
|
||||
|
||||
if(distToTarget<=4.f||m.F(A::TARGET_TIMER)==0.f){
|
||||
if(distToTarget<=4.f||m.F(A::TARGET_TIMER)==0.f||m.B(A::COLLIDED_WITH_PLAYER)){
|
||||
m.phase=3;
|
||||
m.RemoveBuff(SPEEDBOOST);
|
||||
m.RemoveBuff(FIXED_COLLISION_DMG);
|
||||
|
@ -120,7 +120,7 @@ debug_access_options = 0
|
||||
debug_menu_navigation_info = 0
|
||||
|
||||
# Shows map loading output
|
||||
debug_map_load_info = 0
|
||||
debug_map_load_info = 1
|
||||
|
||||
# Shows state transition information
|
||||
debug_transition_info = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user