Ability for king to knight player, wins game

main
parent f053fdb445
commit 595a54a44e

@ -35,6 +35,8 @@ ActionInfo actions[] = {
{.name = "joins_player", }, {.name = "joins_player", },
{.name = "leaves_player", }, {.name = "leaves_player", },
{.name = "stops_fighting_player", }, {.name = "stops_fighting_player", },
{.name = "knights_player", },
}; };
typedef struct typedef struct

@ -2543,6 +2543,10 @@ void frame(void)
player_in_combat = false; // in combat set by various enemies when they fight the player player_in_combat = false; // in combat set by various enemies when they fight the player
PROFILE_SCOPE("entity processing") PROFILE_SCOPE("entity processing")
{ {
if(player->knighted)
{
gs.won = true;
}
ENTITIES_ITER(gs.entities) ENTITIES_ITER(gs.entities)
{ {
assert(!(it->exists && it->generation == 0)); assert(!(it->exists && it->generation == 0));

@ -236,6 +236,7 @@ typedef struct Entity
// character // character
bool is_character; bool is_character;
bool knighted;
EntityRef holding_item; EntityRef holding_item;
bool in_conversation_mode; bool in_conversation_mode;
Vec2 to_throw_direction; Vec2 to_throw_direction;
@ -297,6 +298,12 @@ void fill_available_actions(Entity *it, AvailableActions *a)
*a = (AvailableActions) { 0 }; *a = (AvailableActions) { 0 };
BUFF_APPEND(a, ACT_none); BUFF_APPEND(a, ACT_none);
BUFF_APPEND(a, ACT_give_item); BUFF_APPEND(a, ACT_give_item);
if (it->npc_kind == NPC_TheKing)
{
BUFF_APPEND(a, ACT_knights_player);
}
if (it->npc_kind == NPC_GodRock) if (it->npc_kind == NPC_GodRock)
{ {
BUFF_APPEND(a, ACT_heals_player); BUFF_APPEND(a, ACT_heals_player);
@ -407,6 +414,10 @@ void process_perception(Entity *it, Perception p, Entity *player)
{ {
it->standing = STANDING_FIGHTING; it->standing = STANDING_FIGHTING;
} }
else if(p.npc_action_type == ACT_knights_player)
{
player->knighted = true;
}
else if (p.npc_action_type == ACT_stops_fighting_player) else if (p.npc_action_type == ACT_stops_fighting_player)
{ {
it->standing = STANDING_INDIFFERENT; it->standing = STANDING_INDIFFERENT;

Loading…
Cancel
Save