Phase 1 and 2 implemented.

pull/35/head
sigonasr2 1 year ago
parent bc702788cf
commit 4d3b3b4930
  1. 4
      Adventures in Lestoria/Adventures in Lestoria.vcxproj
  2. 3
      Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
  3. 2
      Adventures in Lestoria/AdventuresInLestoria.cpp
  4. 7
      Adventures in Lestoria/BulletTypes.h
  5. 1
      Adventures in Lestoria/Monster.h
  6. 1
      Adventures in Lestoria/MonsterAttribute.h
  7. 1
      Adventures in Lestoria/MonsterStrategyHelpers.h
  8. 7
      Adventures in Lestoria/RUN_STRATEGY.cpp
  9. 2
      Adventures in Lestoria/TODO.txt
  10. 53
      Adventures in Lestoria/Ursule.cpp
  11. 2
      Adventures in Lestoria/Version.h
  12. 64
      Adventures in Lestoria/Wisp.cpp
  13. 13
      Adventures in Lestoria/assets/config/MonsterStrategies.txt
  14. 1
      Adventures in Lestoria/assets/config/Monsters.txt
  15. 5
      Adventures in Lestoria/assets/config/audio/events.txt
  16. 1
      Adventures in Lestoria/assets/config/gfx/gfx.txt
  17. BIN
      Adventures in Lestoria/assets/monsters/Ursule Mother of Bears2.png
  18. BIN
      Adventures in Lestoria/assets/monsters/Ursule, Mother of Bears.png
  19. BIN
      Adventures in Lestoria/assets/sounds/wisp_hit.ogg
  20. BIN
      Adventures in Lestoria/assets/wisp.png
  21. BIN
      x64/Release/Adventures in Lestoria.exe

@ -698,6 +698,10 @@
<ClCompile Include="VisualNovel.cpp" />
<ClCompile Include="Warrior.cpp" />
<ClCompile Include="util.cpp" />
<ClCompile Include="Wisp.cpp">
<SubType>
</SubType>
</ClCompile>
<ClCompile Include="Witch.cpp" />
<ClCompile Include="Wizard.cpp" />
<ClCompile Include="Wolf.cpp" />

@ -749,6 +749,9 @@
<ClCompile Include="Ursule.cpp">
<Filter>Source Files\Monster Strategies</Filter>
</ClCompile>
<ClCompile Include="Wisp.cpp">
<Filter>Source Files\Bullet Types</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />

@ -702,7 +702,7 @@ void AiL::UpdateBullets(float fElapsedTime){
}else{
b->pos+=b->vel*fElapsedTime;
}
if(b->pos.x+b->radius<view.GetWorldTL().x-WINDOW_SIZE.x||b->pos.x-b->radius>view.GetWorldBR().x+WINDOW_SIZE.x||b->pos.y+b->radius<view.GetWorldTL().y-WINDOW_SIZE.y||b->pos.y-b->radius>view.GetWorldBR().y+WINDOW_SIZE.y){
if(/*World size in PIXELS!*/vi2d worldSize=GetCurrentMap().MapData.MapSize*GetCurrentMap().MapData.TileSize;b->pos.x+b->radius<-WINDOW_SIZE.x||b->pos.x-b->radius>worldSize.x+WINDOW_SIZE.x||b->pos.y+b->radius<-WINDOW_SIZE.y||b->pos.y-b->radius>worldSize.y+WINDOW_SIZE.y){
b->dead=true;
continue;
}

@ -90,4 +90,11 @@ struct FrogTongue:public Bullet{
bool PlayerHit(Player*player)override;
bool MonsterHit(Monster&monster)override;
void Draw()override;
};
struct Wisp:public Bullet{
Wisp(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly=false,Pixel col=WHITE);
void Update(float fElapsedTime)override;
bool PlayerHit(Player*player)override;
bool MonsterHit(Monster&monster)override;
};

@ -250,6 +250,7 @@ private:
static float _GetFloat(Monster&m,std::string param,std::string strategy,int index=0);
static Pixel _GetPixel(Monster&m,std::string param,std::string strategy,int index=0);
static std::string _GetString(Monster&m,std::string param,std::string strategy,int index=0);
static datafile _Get(Monster&m,std::string param,std::string strategy);
static void RUN_STRATEGY(Monster&m,float fElapsedTime);
static void RUN_TOWARDS(Monster&m,float fElapsedTime,std::string strategy);
static void SHOOT_AFAR(Monster&m,float fElapsedTime,std::string strategy);

@ -85,4 +85,5 @@ enum class Attribute{
PATH_INDEX,
PATH_DIR,
PREV_POS,
WISP_PATTERN_LIST,
};

@ -40,6 +40,7 @@ All rights reserved.
#define ConfigFloat(param) _GetFloat(m,param,strategy)
#define ConfigPixel(param) _GetPixel(m,param,strategy)
#define ConfigString(param) _GetString(m,param,strategy)
#define Config(param) _Get(m,param,strategy)
#define ConfigIntArr(param,ind) _GetInt(m,param,strategy,ind)
#define ConfigFloatArr(param,ind) _GetFloat(m,param,strategy,ind)
#define ConfigStringArr(param,ind) _GetString(m,param,strategy,ind)

@ -77,6 +77,13 @@ std::string Monster::STRATEGY::_GetString(Monster&m,std::string param,std::strin
return DATA["MonsterStrategy"][strategy].GetProperty(param).GetString(index);
}
}
datafile Monster::STRATEGY::_Get(Monster&m,std::string param,std::string strategy){
if(DATA["Monsters"][m.name].HasProperty(param)){
return DATA["Monsters"][m.name].GetProperty(param);
} else {
return DATA["MonsterStrategy"][strategy].GetProperty(param);
}
}
Pixel Monster::STRATEGY::_GetPixel(Monster&m,std::string param,std::string strategy,int index){
if(DATA["Monsters"][m.name].HasProperty(param)){
return DATA["Monsters"][m.name].GetProperty(param).GetPixel(index);

@ -39,6 +39,8 @@ ERR messages become just output messages in release build and won't crash the ga
- Hold mouse down to increase quantity
- Auto aim causes retreat-type moves to aim away from the auto target, and prefer the direction the player's moving in.
- Getting hurt has additional effects.

@ -64,6 +64,7 @@ void Monster::STRATEGY::URSULE(Monster&m,float fElapsedTime,std::string strategy
m.phase=2;
m.PerformOtherAnimation(1);
m.AddBuff(BARRIER_DAMAGE_REDUCTION,INFINITE,ConfigFloat("Phase 2.Barrier Damage Reduction")/100.f);
m.I(A::PHASE_REPEAT_COUNT)=ConfigInt("Phase 2.Wisp Pattern Spawn Count");
};
if(m.GetRemainingHPPct()<=ConfigFloat("Phase 2.Change")/100.f){
@ -106,7 +107,57 @@ void Monster::STRATEGY::URSULE(Monster&m,float fElapsedTime,std::string strategy
BEAR(m,fElapsedTime,"Bear");
}break;
case 2:{
m.PerformOtherAnimation(2);
m.F(A::SHOOT_TIMER)=std::max(0.f,m.F(A::SHOOT_TIMER)-fElapsedTime);
if(m.I(A::PHASE_REPEAT_COUNT)>0){
if(m.F(A::SHOOT_TIMER)==0.f){
uint8_t wispPatternCount=ConfigInt("Wisp Pattern Count");
uint8_t wispPattern=util::random()%wispPatternCount;
if(ConfigString("Phase 2.Wisp Pattern Random Selection")=="Bag"){
if(m.VEC(A::WISP_PATTERN_LIST).size()==0){
for(uint8_t numb=0;numb<wispPatternCount;numb++){ //Numbers are randomly inserted into the list.
m.VEC(A::WISP_PATTERN_LIST).insert(m.VEC(A::WISP_PATTERN_LIST).begin()+(util::random()%(m.VEC(A::WISP_PATTERN_LIST).size()+1)),numb);
}
}
wispPattern=std::any_cast<uint8_t>(m.VEC(A::WISP_PATTERN_LIST).back());
m.VEC(A::WISP_PATTERN_LIST).pop_back();
}
m.F(A::SHOOT_TIMER)=ConfigFloat("Phase 2.Wisp Pattern Spawn Wait Time");
vi2d wispSize={ConfigIntArr("Phase 2.Wisp Size",0),ConfigIntArr("Phase 2.Wisp Size",1)};
float rowWidth=ConfigString(std::format("Wisp Pattern {}.Row[0]",wispPattern)).length()*wispSize.x; // Width of a wisp set in pixels.
float mapWidth=game->GetCurrentMap().MapData.MapSize.x*float(game->GetCurrentMap().MapData.tilewidth);
int rowCount=Config(std::format("Wisp Pattern {}",wispPattern)).GetKeys().size();
for(float x=0;x<mapWidth;x+=wispSize.x){
for(int y=0;y<rowCount;y++){
float ySpawn=ConfigInt("Phase 2.Wisp Pattern Spawn Y")+y*wispSize.y;
BULLET_LIST.push_back(std::make_unique<Wisp>(vf2d{x,ySpawn},vf2d{0,ConfigFloat("Phase 2.Wisp Speed")},wispSize.x/2,m.GetAttack(),m.OnUpperLevel(),false,ConfigPixel("Phase 2.Wisp Color")));
}
}
m.I(A::PHASE_REPEAT_COUNT)--;
}
}else{
if(m.F(A::RECOVERY_TIME)==0.f){
if(ConfigFloat("Phase 2.Wisp Count Phase Change Wait")==0.f)m.phase=3;
m.F(A::RECOVERY_TIME)=ConfigFloat("Phase 2.Wisp Count Phase Change Wait");
}else{
m.F(A::RECOVERY_TIME)-=fElapsedTime;
if(m.F(A::RECOVERY_TIME)<=0.f){
m.phase=3;
}
}
}
}break;
case 3:{
std::cout<<"Phase 3"<<std::endl;
}break;
default:{
ERR(std::format("WARNING! Unknown phase {} for {} reached!",m.phase,m.GetName()));
}
}
}

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 3
#define VERSION_PATCH 0
#define VERSION_BUILD 6300
#define VERSION_BUILD 6308
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -0,0 +1,64 @@
#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2024 Joshua Sigona <sigonasr2@gmail.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions or derivations of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions or derivative works in binary form must reproduce the above
copyright notice. This list of conditions and the following disclaimer must be
reproduced in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may
be used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Portions of this software are copyright © 2023 The FreeType
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#include "BulletTypes.h"
#include "SoundEffect.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
INCLUDE_game
Wisp::Wisp(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly,Pixel col)
:Bullet(pos,vel,radius,damage,"wisp.png",upperLevel,false,INFINITE,false,friendly,col){}
void Wisp::Update(float fElapsedTime){
}
bool Wisp::PlayerHit(Player*player){
deactivated=true;
SoundEffect::PlaySFX("Wisp Hit",player->GetPos());
game->AddEffect(std::make_unique<Effect>(player->GetPos(),0,"splash_effect.png",upperLevel,player->GetSizeMult(),0.25,vf2d{},"MonsterStrategy.Ursule.Phase 2.Wisp Color"_Pixel));
fadeOutTime="MonsterStrategy.Ursule.Phase 2.Wisp Fadeout Time"_F;
return false;
}
bool Wisp::MonsterHit(Monster&monster){
deactivated=true;
SoundEffect::PlaySFX("Wisp Hit",monster.GetPos());
game->AddEffect(std::make_unique<Effect>(monster.GetPos(),0,"splash_effect.png",upperLevel,monster.GetSizeMult(),0.25,vf2d{},"MonsterStrategy.Ursule.Phase 2.Wisp Color"_Pixel));
fadeOutTime="MonsterStrategy.Ursule.Phase 2.Wisp Fadeout Time"_F;
return false;
}

@ -239,6 +239,9 @@ MonsterStrategy
# The overlay sprite to use for transitioning to later phases.
Overlay Sprite = monsters/Ursule Mother of Bears2.png
# Number of wisp patterns that exist.
Wisp Pattern Count = 9
Wisp Pattern 0
{
Row[0] = .O...O..
@ -337,8 +340,11 @@ MonsterStrategy
# Percentage of damage reduced on the bear while the barrier is active.
Barrier Damage Reduction = 100%
# Wisp size in pixels.
Wisp Size = 24,24
# Speed at which the wisp moves downwards.
Wisp Speed = 100%
Wisp Speed = 100
# RGBA value of the wisp.
Wisp Color = 247, 157, 0, 255
@ -346,9 +352,12 @@ MonsterStrategy
# There are 6 rows of wisps and we want them to spawn outside the arena
Wisp Pattern Spawn Y = -144
# Amount of time the wisp fades out after hitting the player.
Wisp Fadeout Time = 0.3s
# How much time (in seconds) to wait between each pattern spawn.
# 100% speed means it takes 6 seconds for all the wisps to move entirely down.
Wisp Pattern Spawn Wait Time = 6.0s
Wisp Pattern Spawn Wait Time = 1.44s
# This value is either Bag or Random. Bag means every pattern gets selected once before re-cycling. Random is truly random with potential repeats.
Wisp Pattern Random Selection = Bag

@ -385,5 +385,6 @@ Monsters
# NOTE: ANIMATION[0] will always be row 5 of an animation sheet, all numbers that follow are each below each other.
ANIMATION[0] = 4, 0.1, OneShot
ANIMATION[1] = 6, 0.15, OneShot
ANIMATION[2] = 2, 0.2, Reverse
}
}

@ -165,6 +165,11 @@ Events
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = warrior_sonicslash.ogg, 70%
}
Wisp Hit
{
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = wisp_hit.ogg, 60%
}
Wizard Auto Attack
{
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)

@ -63,6 +63,7 @@ Images
GFX_Overworld_Arrow = overworld_arrow.png
GFX_Exclamation = exclamation.png
GFX_Ursule2 = monsters/Ursule Mother of Bears2.png
GFX_Wisp = wisp.png
# Ability Icons
GFX_Warrior_BattleCry_Icon = Ability Icons/battlecry.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

Loading…
Cancel
Save