mirror of
https://github.com/zoriya/ForecastingVillage.git
synced 2026-06-01 10:15:07 +00:00
Loading a game over screen on loose
This commit is contained in:
@@ -26,7 +26,7 @@ void uppercut(gc_engine *engine, gc_entity *from, gc_entity *enemy)
|
||||
max = 20 - this->last_damage;
|
||||
else
|
||||
max = 10;
|
||||
this->last_damage = MIN(random() % max, 10);
|
||||
this->last_damage = MAX(MIN(random() % max, 10), 0);
|
||||
this->last_damage *= inv && inv->inventory_upgrades[2] ? 1 : 1.5;
|
||||
this->last_attack = "uppercut";
|
||||
rem_health(enemy_health, engine, this->last_damage);
|
||||
@@ -46,7 +46,7 @@ void water_jet(gc_engine *engine, gc_entity *from, gc_entity *enemy)
|
||||
max = 20 - this->last_damage;
|
||||
else
|
||||
max = 10;
|
||||
this->last_damage = MIN(random() % max, 10);
|
||||
this->last_damage = MAX(MIN(random() % max, 10), 0);
|
||||
this->last_damage *= inv && inv->inventory_upgrades[1] ? 1 : 1.5;
|
||||
this->last_attack = "water_jet";
|
||||
rem_health(enemy_health, engine, this->last_damage);
|
||||
@@ -66,7 +66,7 @@ void fireball(gc_engine *engine, gc_entity *from, gc_entity *enemy)
|
||||
max = 20 - this->last_damage;
|
||||
else
|
||||
max = 10;
|
||||
this->last_damage = MIN(random() % max, 10);
|
||||
this->last_damage = MAX(MIN(random() % max, 10), 0);
|
||||
this->last_damage *= inv && inv->inventory_upgrades[0] ? 1 : 1.5;
|
||||
this->last_attack = "fireball";
|
||||
rem_health(enemy_health, engine, this->last_damage);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <components/player_component.h>
|
||||
#include <stdlib.h>
|
||||
#include <components/controllable_component.h>
|
||||
#include <prefab.h>
|
||||
#include "engine.h"
|
||||
#include "my.h"
|
||||
#include "components/dialog_holder.h"
|
||||
@@ -48,6 +49,8 @@ void combat_end(gc_engine *engine, bool has_won)
|
||||
this->state = ATTACK;
|
||||
dialog->dialog_id = -1;
|
||||
dialog->input_id = -1;
|
||||
if (!has_won)
|
||||
prefab_load(engine, "prefabs/game_over.gcprefab");
|
||||
}
|
||||
|
||||
static void update_entity(gc_engine *engine, void *system, gc_entity *entity, \
|
||||
|
||||
@@ -79,8 +79,6 @@ void attack_callback(gc_engine *engine, int index)
|
||||
|
||||
if (!li || !get_player_and_enemy(scene, &player_entity, &enemy))
|
||||
return;
|
||||
if (GETCMP(player_entity, health_component)->dead)
|
||||
combat_end(engine, false);
|
||||
if (!(player = GETCMP(player_entity, attack_component)))
|
||||
return;
|
||||
if (player->attacks[index].run)
|
||||
@@ -101,15 +99,17 @@ gc_scene *scene, gc_engine *engine)
|
||||
|
||||
if (!player_entity)
|
||||
return;
|
||||
player = GETCMP(player_entity, attack_component);
|
||||
if (!player)
|
||||
if (GETCMP(player_entity, health_component)->dead) {
|
||||
combat_end(engine, false);
|
||||
return;
|
||||
if (player->attacks) {
|
||||
}
|
||||
if (!(player = GETCMP(player_entity, attack_component)))
|
||||
return;
|
||||
if (player->attacks)
|
||||
for (i = 0; player->attacks[i].name && i < 4; i++) {
|
||||
inputs[i].text = player->attacks[i].name;
|
||||
inputs[i].callback = &attack_callback;
|
||||
}
|
||||
}
|
||||
inputs[i].text = NULL;
|
||||
dialog_add_line(dialog, NULL, ATTACK_TEXT, inputs);
|
||||
this->state = ATTACKING;
|
||||
|
||||
Reference in New Issue
Block a user