Fix Parrot spritesheet size. Pirate Captain behavior fixed (cannot directly inherit from Goblin Dagger, copy-paste AI instead due to conflicting states). Release Build 11653.

master
sigonasr2 2 months ago
parent 5f63f23635
commit 20f8abf8b5
  1. 62
      Adventures in Lestoria/Pirate_Captain.cpp
  2. 2
      Adventures in Lestoria/Version.h
  3. 12
      Adventures in Lestoria/assets/config/Monsters.txt
  4. BIN
      x64/Release/Adventures in Lestoria.exe

@ -54,8 +54,20 @@ void Monster::STRATEGY::PIRATE_CAPTAIN(Monster&m,float fElapsedTime,std::string
PREPARE_SHOOT,
SHOOT_RELOAD,
DRINK_RUM,
WINDUP,
RECOVERY,
};
enum AttackType{
STAB,
SLASH
};
if(!m.B(A::INITIALIZED)){
m.B(A::INITIALIZED)=true;
m.phase=INIT;
}
switch(m.phase){
case INIT:{
m.F(A::TARGET_TIMER)=ConfigFloat("Shooting Frequency");
@ -72,8 +84,6 @@ void Monster::STRATEGY::PIRATE_CAPTAIN(Monster&m,float fElapsedTime,std::string
}break;
case MOVE:{
m.F(A::TARGET_TIMER)-=fElapsedTime;
GOBLIN_DAGGER(m,fElapsedTime,"Goblin Dagger");
if(m.F(A::TARGET_TIMER)<=0.f){
const float diceRoll{util::random(100)};
if(diceRoll<=ConfigFloat("Shooting Chance")){
@ -92,6 +102,26 @@ void Monster::STRATEGY::PIRATE_CAPTAIN(Monster&m,float fElapsedTime,std::string
m.F(A::BREAK_TIME)=m.GetCurrentAnimation().GetTotalAnimationDuration();
m.phase=DRINK_RUM;
}
else{
float distToPlayer=m.GetDistanceFrom(game->GetPlayer()->GetPos());
if(distToPlayer>ConfigFloat("Attack Spacing")/100.f*24){
RUN_TOWARDS(m,fElapsedTime,"Run Towards");
}else{
m.phase=WINDUP;
m.I(A::ATTACK_TYPE)=util::random()%2; //Choose randomly between stab or slash.
switch(m.I(A::ATTACK_TYPE)){
case STAB:{
m.F(A::CASTING_TIMER)=ConfigFloat("Stab Windup Time");
m.PerformAnimation("STAB",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos()));
}break;
case SLASH:{
m.F(A::CASTING_TIMER)=ConfigFloat("Slash Windup Time");
m.PerformAnimation("SLASH",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos()));
}break;
default:ERR(std::format("WARNING! Invalid Attack type {} provided. THIS SHOULD NOT BE HAPPENING!",m.I(A::ATTACK_TYPE)));
}
}
}
}break;
case PREPARE_SHOOT:{
m.F(A::SHOOT_TIMER)-=fElapsedTime;
@ -116,5 +146,33 @@ void Monster::STRATEGY::PIRATE_CAPTAIN(Monster&m,float fElapsedTime,std::string
m.phase=MOVE;
}
}break;
case WINDUP:{
m.F(A::CASTING_TIMER)-=fElapsedTime;
if(m.F(A::CASTING_TIMER)<=0){
m.phase=RECOVERY;
switch(m.I(A::ATTACK_TYPE)){
case STAB:{
vf2d stabTarget=game->GetPlayer()->GetPos();
m.PerformAnimation("STABBING",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos()));
CreateBullet(DaggerStab)(m,ConfigString("Dagger Stab Image"),ConfigFloat("Dagger Hit Radius"),m.GetAttack(),ConfigFloat("Dagger Stab Knockback"),m.OnUpperLevel(),m.GetFacingDirectionToTarget(stabTarget),ConfigFloat("Dagger Frame Duration"),ConfigFloat("Dagger Stab Distance"),
DaggerStab::DirectionOffsets{ConfigVec("Dagger Up Offset"),ConfigVec("Dagger Down Offset"),ConfigVec("Dagger Right Offset"),ConfigVec("Dagger Left Offset")})EndBullet;
}break;
case SLASH:{
vf2d slashTarget=game->GetPlayer()->GetPos();
m.PerformAnimation("SLASHING",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos()));
CreateBullet(DaggerSlash)(m,ConfigString("Dagger Slash Image"),ConfigFloat("Dagger Hit Radius"),m.GetAttack(),ConfigFloat("Dagger Slash Knockback"),m.OnUpperLevel(),m.GetFacingDirectionToTarget(slashTarget),ConfigFloat("Dagger Frame Duration"),ConfigFloat("Dagger Slash Distance"))EndBullet;
}break;
default:ERR(std::format("WARNING! Invalid Attack type {} provided. THIS SHOULD NOT BE HAPPENING!",m.I(A::ATTACK_TYPE)));
}
m.F(A::CASTING_TIMER)=m.GetCurrentAnimation().GetTotalAnimationDuration();
m.F(A::RECOVERY_TIME)=ConfigFloat("Attack Recovery Time");
}
}break;
case RECOVERY:{
m.F(A::CASTING_TIMER)-=fElapsedTime;
m.F(A::RECOVERY_TIME)-=fElapsedTime;
if(m.F(A::CASTING_TIMER)<=0){m.PerformIdleAnimation(m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos()));}
if(m.F(A::RECOVERY_TIME)<=0)m.phase=MOVE;
}break;
}
}

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

@ -1393,6 +1393,9 @@ Monsters
# Setting this to true means every four rows indicates one animation, the ordering of the directions is: NORTH, EAST, SOUTH, WEST
4-Way Spritesheet = True
# Wait time override for Run Towards strategy.
WaitTime = 0
#### Script Override ####
# The Pirate Captain normally behaves as the Pirate, which also borrows from Goblin Dagger.
@ -1406,6 +1409,8 @@ Monsters
# Number of pixels of reach the dagger stab has.
Dagger Stab Distance = 4
Dagger Stab Knockback = 100
# Number of pixels of reach the dagger slash has from the monster.
Dagger Slash Distance = 12
@ -1422,6 +1427,11 @@ Monsters
Dagger Slash Image = "pirate_slash.png"
# How long between each dagger stab frame.
Dagger Frame Duration = 0.1s
Dagger Slash Knockback = 75
# Offset for the dagger stab effect per direction from the monster's center.
Dagger Up Offset = -6,-5.5
Dagger Down Offset = -5,-1
@ -1678,7 +1688,7 @@ Monsters
Unconscious Time = 5s
#Size of each animation frame
SheetFrameSize = 96,96
SheetFrameSize = 48,48
# Setting this to true means every four rows indicates one animation, the ordering of the directions is: NORTH, EAST, SOUTH, WEST
4-Way Spritesheet = True

Loading…
Cancel
Save