Implement Pirate strategy. Refactor Dagger Stab/Slash slightly. After loading a resource pack, if it previously failed to load attempt the load again to stop game crashes with modifications to the game pack. Release Build 11602.
This commit is contained in:
parent
90d9bc86b1
commit
9509f317c3
@ -281,7 +281,7 @@ void InitializeGameConfigurations(){
|
||||
}
|
||||
|
||||
bool AiL::OnUserCreate(){
|
||||
if(PACK_KEY=="INSERT_PACK_KEY_HERE")ERR("ERROR! Starting the game with the default pack ID is not allowed!")
|
||||
if(PACK_KEY=="INSERT_PACK_KEY_HERE")ERR("ERROR! Starting the game with the default pack ID is not allowed!");
|
||||
gamepack.LoadPack("assets/"+"gamepack_file"_S,PACK_KEY);
|
||||
|
||||
GamePad::init();
|
||||
@ -389,6 +389,7 @@ bool AiL::OnUserCreate(){
|
||||
if(!gamepack.Loaded()&&"GENERATE_GAMEPACK"_B){
|
||||
gamepack.SavePack("assets/"+"gamepack_file"_S,PACK_KEY);
|
||||
LOG("Game Pack has been generated!"<<std::endl<<"========================"<<std::endl);
|
||||
gamepack.LoadPack("assets/"+"gamepack_file"_S,PACK_KEY);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -41,6 +41,6 @@ All rights reserved.
|
||||
Bullet::Bullet(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly,Pixel col,vf2d scale,float image_angle)
|
||||
:IBullet(pos,vel,radius,damage,upperLevel,friendly,col,scale,image_angle){}
|
||||
//Initializes a bullet with an animation.
|
||||
Bullet::Bullet(vf2d pos,vf2d vel,float radius,int damage,std::string animation,bool upperLevel,bool hitsMultiple,float lifetime,bool rotatesWithAngle,bool friendly,Pixel col,vf2d scale,float image_angle,std::string_view hitSound)
|
||||
Bullet::Bullet(vf2d pos,vf2d vel,float radius,int damage,const std::string&animation,bool upperLevel,bool hitsMultiple,float lifetime,bool rotatesWithAngle,bool friendly,Pixel col,vf2d scale,float image_angle,std::string_view hitSound)
|
||||
:IBullet(pos,vel,radius,damage,animation,upperLevel,hitsMultiple,lifetime,rotatesWithAngle,friendly,col,scale,image_angle,hitSound){}
|
||||
void Bullet::ModifyOutgoingDamageData(HurtDamageInfo&data){}
|
@ -43,7 +43,7 @@ class Bullet:public IBullet{
|
||||
public:
|
||||
Bullet(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly=false,Pixel col=WHITE,vf2d scale={1,1},float image_angle=0.f);
|
||||
//Initializes a bullet with an animation.
|
||||
Bullet(vf2d pos,vf2d vel,float radius,int damage,std::string animation,bool upperLevel,bool hitsMultiple=false,float lifetime=INFINITE,bool rotatesWithAngle=false,bool friendly=false,Pixel col=WHITE,vf2d scale={1,1},float image_angle=0.f,std::string_view hitSound="");
|
||||
Bullet(vf2d pos,vf2d vel,float radius,int damage,const std::string&animation,bool upperLevel,bool hitsMultiple=false,float lifetime=INFINITE,bool rotatesWithAngle=false,bool friendly=false,Pixel col=WHITE,vf2d scale={1,1},float image_angle=0.f,std::string_view hitSound="");
|
||||
protected:
|
||||
virtual void ModifyOutgoingDamageData(HurtDamageInfo&data);
|
||||
};
|
@ -148,7 +148,7 @@ struct DaggerStab:public Bullet{
|
||||
float daggerStabDistance;
|
||||
float knockbackAmt;
|
||||
DirectionOffsets daggerPositionOffsets;
|
||||
DaggerStab(Monster&sourceMonster,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerStabDistance,const DirectionOffsets offsets,bool friendly=false,Pixel col=WHITE);
|
||||
DaggerStab(Monster&sourceMonster,const std::string&image,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerStabDistance,const DirectionOffsets offsets,bool friendly=false,Pixel col=WHITE);
|
||||
void Update(float fElapsedTime)override;
|
||||
BulletDestroyState PlayerHit(Player*player)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _PlayerHit()!!
|
||||
BulletDestroyState MonsterHit(Monster&monster,const uint8_t markStacksBeforeHit)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _MonsterHit()!!
|
||||
@ -161,7 +161,7 @@ struct DaggerSlash:public Bullet{
|
||||
float frameDuration;
|
||||
float daggerSlashDistance;
|
||||
float knockbackAmt;
|
||||
DaggerSlash(Monster&sourceMonster,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerSlashDistance,bool friendly=false,Pixel col=WHITE);
|
||||
DaggerSlash(Monster&sourceMonster,const std::string&image,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerSlashDistance,bool friendly=false,Pixel col=WHITE);
|
||||
void Update(float fElapsedTime)override;
|
||||
BulletDestroyState PlayerHit(Player*player)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _PlayerHit()!!
|
||||
BulletDestroyState MonsterHit(Monster&monster,const uint8_t markStacksBeforeHit)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _MonsterHit()!!
|
||||
|
@ -45,8 +45,8 @@ All rights reserved.
|
||||
INCLUDE_game
|
||||
INCLUDE_ANIMATION_DATA
|
||||
|
||||
DaggerSlash::DaggerSlash(Monster&sourceMonster,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerSlashDistance,bool friendly,Pixel col)
|
||||
:Bullet(sourceMonster.GetPos(),{},radius,damage,"goblin_sword_slash.png",upperLevel,false,daggerFrameDuration*ANIMATION_DATA["goblin_sword_slash.png"].GetFrameCountBasedOnAnimationStyle(),true,friendly,col),
|
||||
DaggerSlash::DaggerSlash(Monster&sourceMonster,const std::string&image,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerSlashDistance,bool friendly,Pixel col)
|
||||
:Bullet(sourceMonster.GetPos(),{},radius,damage,image,upperLevel,false,daggerFrameDuration*ANIMATION_DATA["goblin_sword_slash.png"].GetFrameCountBasedOnAnimationStyle(),true,friendly,col),
|
||||
sourceMonster(sourceMonster),frameDuration(daggerFrameDuration),daggerSlashDistance(daggerSlashDistance),facingDir(facingDir),knockbackAmt(knockbackAmt){}
|
||||
void DaggerSlash::Update(float fElapsedTime){
|
||||
ANIMATION_DATA["goblin_sword_slash.png"].ChangeFrameDuration(frameDuration);
|
||||
|
@ -45,8 +45,8 @@ All rights reserved.
|
||||
INCLUDE_game
|
||||
INCLUDE_ANIMATION_DATA
|
||||
|
||||
DaggerStab::DaggerStab(Monster&sourceMonster,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerStabDistance,const DirectionOffsets offsets,bool friendly,Pixel col)
|
||||
:Bullet(sourceMonster.GetPos(),{},radius,damage,"dagger_stab.png",upperLevel,false,daggerFrameDuration*ANIMATION_DATA["dagger_stab.png"].GetFrameCountBasedOnAnimationStyle(),true,friendly,col),
|
||||
DaggerStab::DaggerStab(Monster&sourceMonster,const std::string&image,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerStabDistance,const DirectionOffsets offsets,bool friendly,Pixel col)
|
||||
:Bullet(sourceMonster.GetPos(),{},radius,damage,image,upperLevel,false,daggerFrameDuration*ANIMATION_DATA["dagger_stab.png"].GetFrameCountBasedOnAnimationStyle(),true,friendly,col),
|
||||
sourceMonster(sourceMonster),frameDuration(daggerFrameDuration),daggerStabDistance(daggerStabDistance),facingDir(facingDir),daggerPositionOffsets(offsets),knockbackAmt(knockbackAmt){}
|
||||
void DaggerStab::Update(float fElapsedTime){
|
||||
ANIMATION_DATA["dagger_stab.png"].ChangeFrameDuration(frameDuration);
|
||||
|
@ -95,13 +95,13 @@ void Monster::STRATEGY::GOBLIN_DAGGER(Monster&m,float fElapsedTime,std::string s
|
||||
case STAB:{
|
||||
vf2d stabTarget=game->GetPlayer()->GetPos();
|
||||
m.PerformAnimation("STABBING",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos()));
|
||||
CreateBullet(DaggerStab)(m,ConfigFloat("Dagger Hit Radius"),m.GetAttack(),ConfigFloat("Dagger Stab Knockback"),m.OnUpperLevel(),m.GetFacingDirectionToTarget(stabTarget),ConfigFloat("Dagger Frame Duration"),ConfigFloat("Dagger Stab Distance"),
|
||||
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,ConfigFloat("Dagger Hit Radius"),m.GetAttack(),ConfigFloat("Dagger Slash Knockback"),m.OnUpperLevel(),m.GetFacingDirectionToTarget(slashTarget),ConfigFloat("Dagger Frame Duration"),ConfigFloat("Dagger Slash Distance"))EndBullet;
|
||||
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)));
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ INCLUDE_WINDOW_SIZE
|
||||
IBullet::IBullet(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly,Pixel col,vf2d scale,float image_angle)
|
||||
:pos(pos),vel(vel),radius(radius),damage(damage),col(col),friendly(friendly),upperLevel(upperLevel),scale(scale),image_angle(image_angle){};
|
||||
|
||||
IBullet::IBullet(vf2d pos,vf2d vel,float radius,int damage,std::string animation,bool upperLevel,bool hitsMultiple,float lifetime,bool rotatesWithAngle,bool friendly,Pixel col,vf2d scale,float image_angle,std::string_view hitSound)
|
||||
IBullet::IBullet(vf2d pos,vf2d vel,float radius,int damage,const std::string&animation,bool upperLevel,bool hitsMultiple,float lifetime,bool rotatesWithAngle,bool friendly,Pixel col,vf2d scale,float image_angle,std::string_view hitSound)
|
||||
:pos(pos),vel(vel),radius(radius),damage(damage),col(col),animated(true),rotates(rotatesWithAngle),lifetime(lifetime),hitsMultiple(hitsMultiple),friendly(friendly),upperLevel(upperLevel),scale(scale),image_angle(image_angle),hitSound(std::string(hitSound)){
|
||||
this->animation.AddState(animation,ANIMATION_DATA.at(animation));
|
||||
this->animation.ChangeState(internal_animState,animation);
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
virtual ~IBullet()=default;
|
||||
IBullet(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly=false,Pixel col=WHITE,vf2d scale={1,1},float image_angle=0.f);
|
||||
//Initializes a bullet with an animation.
|
||||
IBullet(vf2d pos,vf2d vel,float radius,int damage,std::string animation,bool upperLevel,bool hitsMultiple=false,float lifetime=INFINITE,bool rotatesWithAngle=false,bool friendly=false,Pixel col=WHITE,vf2d scale={1,1},float image_angle=0.f,std::string_view hitSound="");
|
||||
IBullet(vf2d pos,vf2d vel,float radius,int damage,const std::string&animation,bool upperLevel,bool hitsMultiple=false,float lifetime=INFINITE,bool rotatesWithAngle=false,bool friendly=false,Pixel col=WHITE,vf2d scale={1,1},float image_angle=0.f,std::string_view hitSound="");
|
||||
public:
|
||||
|
||||
void SimulateUpdate(const float fElapsedTime);
|
||||
|
@ -75,7 +75,7 @@ void Monster::STRATEGY::PIRATE_MARAUDER(Monster&m,float fElapsedTime,std::string
|
||||
m.phase=RECOVERY;
|
||||
vf2d slashTarget=game->GetPlayer()->GetPos();
|
||||
m.PerformAnimation("SLASHING",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos()));
|
||||
CreateBullet(DaggerSlash)(m,ConfigFloat("Dagger Hit Radius"),m.GetAttack(),ConfigFloat("Dagger Slash Knockback"),m.OnUpperLevel(),m.GetFacingDirectionToTarget(slashTarget),ConfigFloat("Dagger Frame Duration"),ConfigFloat("Dagger Slash Distance"))EndBullet;
|
||||
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;
|
||||
m.F(A::CASTING_TIMER)=m.GetCurrentAnimation().GetTotalAnimationDuration();
|
||||
m.F(A::RECOVERY_TIME)=ConfigFloat("Attack Recovery Time");
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 11595
|
||||
#define VERSION_BUILD 11602
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
@ -861,31 +861,11 @@
|
||||
<property name="Upper?" type="bool" value="false"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="3" template="../maps/Monsters/Giant Crab.tx" x="324" y="1608">
|
||||
<properties>
|
||||
<property name="spawner" type="object" value="8"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="4" template="../maps/Monsters/Pirate.tx" x="366" y="1416">
|
||||
<properties>
|
||||
<property name="spawner" type="object" value="8"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="5" template="../maps/Monsters/Pirate.tx" x="492" y="1452">
|
||||
<properties>
|
||||
<property name="spawner" type="object" value="8"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="6" template="../maps/Monsters/Pirate Marauder.tx" x="480" y="1542">
|
||||
<properties>
|
||||
<property name="spawner" type="object" value="8"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="7" template="../maps/Monsters/Pirate Marauder.tx" x="408" y="1542">
|
||||
<properties>
|
||||
<property name="spawner" type="object" value="8"/>
|
||||
</properties>
|
||||
</object>
|
||||
<object id="8" name="Spawn Zone" type="SpawnGroup" x="180" y="1326" width="426" height="306">
|
||||
<ellipse/>
|
||||
</object>
|
||||
|
@ -571,6 +571,10 @@ MonsterStrategy
|
||||
|
||||
Dagger Stab Knockback = 100
|
||||
|
||||
Dagger Stab Image = "dagger_stab.png"
|
||||
|
||||
Dagger Slash Image = "goblin_sword_slash.png"
|
||||
|
||||
# How long between each dagger stab frame.
|
||||
Dagger Frame Duration = 0.1s
|
||||
|
||||
|
@ -1252,6 +1252,20 @@ Monsters
|
||||
Strategy = Goblin Dagger
|
||||
|
||||
#### Script Override ####
|
||||
# Distance from player to run to before swinging weapon.
|
||||
Attack Spacing = 100
|
||||
|
||||
# Number of pixels from the dagger's center that the player would be hit by.
|
||||
Dagger Hit Radius = 16
|
||||
|
||||
# Number of pixels of reach the dagger stab has.
|
||||
Dagger Stab Distance = 4
|
||||
|
||||
# Number of pixels of reach the dagger slash has from the monster.
|
||||
Dagger Slash Distance = 12
|
||||
|
||||
# Slash Attack windup time
|
||||
Slash Windup Time = 0.2s
|
||||
|
||||
# Stab Attack windup time
|
||||
Stab Windup Time = 0.2s
|
||||
@ -1259,6 +1273,16 @@ Monsters
|
||||
# Amount of time where nothing happens after an attack.
|
||||
Attack Recovery Time = 0.6s
|
||||
|
||||
Dagger Stab Image = "pirate_dagger.png"
|
||||
|
||||
Dagger Slash Image = "pirate_slash.png"
|
||||
|
||||
# Offset for the dagger stab effect per direction from the monster's center.
|
||||
Dagger Up Offset = -6,-5.5
|
||||
Dagger Down Offset = -5,-1
|
||||
Dagger Right Offset = 9,0
|
||||
Dagger Left Offset = -8,-2
|
||||
|
||||
########
|
||||
|
||||
# Wait time override for Run Towards strategy.
|
||||
|
@ -111,6 +111,8 @@ Images
|
||||
GFX_Feather = feather.png
|
||||
GFX_LargeRock = large_rock.png
|
||||
GFX_Dagger = dagger.png
|
||||
GFX_PirateDagger = pirate_dagger.png
|
||||
GFX_PirateSlash = pirate_slash.png
|
||||
GFX_Shine = shine.png
|
||||
GFX_TargetMark = target.png
|
||||
GFX_MarkTrail = mark_trail.png
|
||||
|
Binary file not shown.
BIN
Adventures in Lestoria/assets/pirate_dagger.png
Normal file
BIN
Adventures in Lestoria/assets/pirate_dagger.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 612 B |
BIN
Adventures in Lestoria/assets/pirate_slash.png
Normal file
BIN
Adventures in Lestoria/assets/pirate_slash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 565 B |
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user