fp: Add attack upgrade to merchant

This commit is contained in:
doyle 2023-10-08 17:35:57 +11:00
parent 17947c7b69
commit 065292c7ac
3 changed files with 16 additions and 12 deletions

View File

@ -2032,15 +2032,16 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input
continue;
}
defender->hp = defender->hp >= FP_DEFAULT_DAMAGE ? defender->hp - FP_DEFAULT_DAMAGE : 0;
defender->hp = defender->hp >= attacker->base_attack ? defender->hp - attacker->base_attack : 0;
if (defender->hp <= 0) {
defender->is_dying = true;
if (!defender->is_dying) {
FP_GameEntity *coin_receiver = FP_Game_GetEntity(game, attacker->projectile_owner);
if (FP_Game_IsNilEntity(coin_receiver))
coin_receiver = attacker;
coin_receiver->coins += 1;
}
defender->is_dying = true;
}
// NOTE: Kickback ======================================================================
#if 0
@ -2610,8 +2611,9 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer,
if (mapping.merchant == game->play.merchant_terry) {
// TODO(doyle): Attack damage? Or increase attack range?
player->base_attack += DQN_CAST(uint32_t)(FP_DEFAULT_DAMAGE * .3f);
} else if (mapping.merchant == game->play.merchant_graveyard) {
player->stamina_cap += DQN_CAST(uint16_t)(FP_TERRY_DASH_STAMINA_COST * .5f);
player->stamina_cap += DQN_CAST(uint32_t)(FP_TERRY_DASH_STAMINA_COST * .5f);
} else if (mapping.merchant == game->play.merchant_gym) {
player->hp_cap += FP_DEFAULT_DAMAGE;
player->hp = player->hp_cap;

View File

@ -226,13 +226,14 @@ static FP_GameEntity *FP_Game_MakeEntityPointerFV(FP_Game *game, DQN_FMT_STRING_
result->action.sprite_alpha = 1.f;
result->stamina_cap = 93;
result->hp_cap = DQN_CAST(uint16_t)(FP_DEFAULT_DAMAGE * .8f);
result->hp_cap = DQN_CAST(uint32_t)(FP_DEFAULT_DAMAGE * .8f);
result->hp = result->hp_cap;
result->inventory.airports_base_price = 100;
result->inventory.churchs_base_price = 50;
result->inventory.kennels_base_price = 50;
result->inventory.clubs_base_price = 50;
result->base_attack = FP_DEFAULT_DAMAGE;
result->inventory.stamina_base_price = 10;
result->inventory.health_base_price = 10;

View File

@ -224,10 +224,11 @@ struct FP_GameEntity
Dqn_usize coins;
FP_GameInventory inventory;
Dqn_f32 hp;
uint16_t hp_cap;
Dqn_f32 stamina;
uint16_t stamina_cap;
uint32_t hp;
uint32_t hp_cap;
uint32_t stamina;
uint32_t stamina_cap;
uint32_t base_attack;
bool converted_faction;
FP_GameEntityFaction faction;