From 77450100990550ebcd79b719d4ce078e23cd5383 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Tue, 19 Sep 2023 03:38:09 -0500 Subject: [PATCH] Change move towards bump behavior to be a chance to stop an instance of this strategy instead. --- Crawler/Monster.cpp | 4 +++- Crawler/Version.h | 2 +- Crawler/assets/config/MonsterStrategies.txt | 2 ++ Crawler/assets/config/Monsters.txt | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Crawler/Monster.cpp b/Crawler/Monster.cpp index 4cab3f36..9a23eb88 100644 --- a/Crawler/Monster.cpp +++ b/Crawler/Monster.cpp @@ -5,6 +5,8 @@ #include "BulletTypes.h" #include "DEFINES.h" #include "safemap.h" +#include "MonsterStrategyHelpers.h" +#include "utils.h" INCLUDE_ANIMATION_DATA INCLUDE_MONSTER_DATA @@ -207,7 +209,7 @@ void Monster::Collision(Monster&m){ Collision(); } void Monster::Collision(){ - if(strategy==0&&GetState()==State::MOVE_TOWARDS){//The run towards strategy causes state to return to normal upon a collision. + if(strategy==0&&GetState()==State::MOVE_TOWARDS&&util::random(Monster::STRATEGY::_GetInt(*this,"BumpStopChance",strategy))<1){//The run towards strategy causes state to return to normal upon a collision. SetState(State::NORMAL); } } diff --git a/Crawler/Version.h b/Crawler/Version.h index 6c74f57d..3f553d61 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -2,7 +2,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 0 -#define VERSION_BUILD 1342 +#define VERSION_BUILD 1344 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/assets/config/MonsterStrategies.txt b/Crawler/assets/config/MonsterStrategies.txt index a4c826a6..82664907 100644 --- a/Crawler/assets/config/MonsterStrategies.txt +++ b/Crawler/assets/config/MonsterStrategies.txt @@ -43,6 +43,8 @@ MonsterStrategy WaitTime = 3 # How far the monster will travel before reassessing for a new path. MaxDistance = 999999 + # 1 of X chance to stop after bumping into something. + BumpStopChance = 5 } 1 { diff --git a/Crawler/assets/config/Monsters.txt b/Crawler/assets/config/Monsters.txt index 15f0a767..ceadcb00 100644 --- a/Crawler/assets/config/Monsters.txt +++ b/Crawler/assets/config/Monsters.txt @@ -12,6 +12,7 @@ Monsters Size = 80 Strategy = Run Towards + BumpStopChance = 2 #Size of each animation frame SheetFrameSize = 24,24